db schema implementation - cinema managing - database

Task: create db managing for offline cinema. The company has many employees, cinemas and a list of films. The cinema has halls in which film screening sessions are held, which show films that the company has
I have db schema image link, but is contain loop so it is not good. How can i make the schema without loop?

Related

Data modeling in snowflake

We perform ELT in our company. we load the data to the landing zone (which is a database in snowflake) and have schemas as per the source from which it is retrieving the data such as:
LZ(database) -- FACEBOOK<LINKEDIN(schemas)
(Here nothing needs to be changed)
Once all the data is loaded, analysts create views/tasks to do the transformations as per the information needed.
We are moving towards the domain-driven design in snowflake in later part. We have analysts and each analyst belongs to a domain such as sales, and vendor.
We have identified all domains now next step is implementation. There are two ways:
domains as databases
domains as schemas inside a single database
We can have a sales database, a vendor database.
Or we can have a database such as analysts: inside which sales could be a schema and vendor could be a schema.
Which one should I go for and why? I have seen in most cases its schemas only but what could work best and why and what could be the implications is what I am looking for

Permissions in SQL Server based upon the content of a row

I have a table (MainTable), each row contains data for a civil engineering project and the county where the project is located. The DB users, engineers, have been assigned a set of counties in New York State (NYS), this relationship is established by another table (EngineerCountyTable). When MainTable must be updated these are the rules:
I do not want an engineer to be updating data for a project located
in a county, which has not been assigned to him. I want all
the engineers.
Engineers can see all projects regardless of the county where the
project is located.
Is there any way to assign permissions in SQL Server based upon the content a row (County in this case)? Thanks

In distributed Database the data are distributed or the relational entities are distributed?

Distributed Database System Data are logically interrelated but i want know is that, the table's Entities are distributed or the Data of a particular tables are distributed?
Like if there is a table called User then the user's whole data will distribute. like some user's info in this Database and others in the other DB.
or the Entities like id, name, account. and all like foreign key.
the data will be distributed by Row, and would it distribute data by table? like A database may have more tables so the tables are also distributed?

how do I get company ID wise backup or restore the data

I have a mini account software. In this software I can store multiple company data. The data is stored in SQL Server 2008 R2 database.
In current database I have a User table which stores all user names, a Company Master table which stores company details like name,address, session etc. and user ID as FK with user table. Next is tran table which link with company Master and stores vouchers details and others table link to tran tabel like bill, payment etc.
The app is build for small companies and professionals who keep & maintain there their client data. In that scenario all data is separate and mutually independedent. In case of the small company they maintain all subsidiary company's account related data in a single app. Some time they receipt or send any one subsidiary company data to that company or any government body or Audit firms. like mobile phone contacts, I can send all contacts or any selected contact.
Users used to select his/her company first form company Master and then add/edit reference data or view report on the basis of selected company ID.
Now my problem is the data volume is become very high on some client places because of 50 to 60 companies data are stored in a single database and how I get company ID wise backup or restore the data. Is filegroup of sql server can help on this matter? I have no knowledge of filegroup.
Please help me.
Do not split your SQL database into multiple SQL databases (either do not create more filegroups etc.) just because you need to get data filtered by the CompanyId. Everytime when your Client would need to create a new Company, your application would have to create a new database for it. This would also quite complicate things like app updates.
If you do not face any grave performance problems - like when using SQL Express and your client database is 9 GB (max. database size for Express is 10 GB) - leave 1 database for 1 client.
Be sure all your related tables are well indexed by the CompanyID column. Then you can provide means to export data by CompanyID from your application - custom reports, exports to csv files, Excel etc.
Database backup file is usually not used for passing data to other applications. Its goal is to assure disaster recovery - when the disk fails etc. then your client will be able to recover easily. On contrary when he would have 50 database files in place of just 1 he would have hard time restoring all those databases properly.

Database with users design

I am in database design development phase. Application will work with large number of users (LARGE :))
I designed 80% of database but I have one Users table which is connected to everything else:
Users {UserId, FirstName, LastName, Username, Password, PasswordQuestion, PasswordAnswer, Gender, RoleId, LastLoginDate etc etc}
I saw asp.net membership database structure where Users and Membership are two tables. My questions are:
Should I use one users table with all users data in it or more tables?
If answer is 'more tables', what tables to use? Any advice on how to structure relation between those tables?
This is sample relation that I have, and trying to improve. I don't understand why user and userChild are separated tables?
How many tables you need depends on your modeling needs.
For example if you include the RoleId in the Users table then you'll only be able to assign one role per user. Is that what you want?
Otherwise, if you have a separate table linking users to roles, you'll be able to assign more than one role per user.

Resources