Please design a relational schema for my database I want to
Please design a relational schema for my database. I want to open a business in a city and I have business, crime and population information of that city. Please do not forget to mention what type of keys you choose and why. You may draw your tables in a piece of paper and put a screenshot.
BusinessID, Business Start Date, BusinessCouncilDistrict, Business Zipcode( there are mutiple business in one zipcode), BusinessType
Crime ID, Crime Description, Status of Crime, Zipcode of the crime(there are multiple crimes in one zipcode)
Zipcode of city, Total Population in that zipcode , Median age in that zipcode(there is just one population information in one zipcode)
Solution
BusinessID is unique and not null so it is the primary key of BusinessInformation table.
CrimeID is unique and not null so it is primary key of CrimeInformation Table
Zipcode is unique and not null so it is the primary key of ZipCodeinformation table.
Also BusinessZipcode of Businessinformation table is foreign key to Zipcode of ZipcodeInformation table.
Also ZipcodeOfCrime of CrimeInformation table is foreign key to Zipcode of ZipcodeInformation table.
Table: BusinessInformation
BusinessID PK
BusinessStartDate
BusinessCouncilDistrict
BusinessZipcode FK
Table: ZipcodeInformation
Zipcode PK
Population
MedianAge
Table:CrimeInformation
CrimeID PK
CrimeDescription
StatusOfCrime
ZipcodeOfCrime FK
| BusinessID PK |
| BusinessStartDate |
| BusinessCouncilDistrict |
| BusinessZipcode FK |
