Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Create tables for a database

Author  Topic 

menssanvik
Starting Member

3 Posts

Posted - 2014-07-16 : 10:19:11
Hi I am new to all this so trying to make sense of all. I can create a simple table but not sure what to do with the rest -:) Any help will be much appreciated.

Create a Database with the following:
a) Database to contain a list of people, their addresses, email addresses, and phone numbers.
b) Database to contain a list of cars, their names, their type (2 doors,4 doors, etc.), and their colour.
c) Database to allow only one owner per car
d) Database to allow multiple people to be able to act upon behalf of one car. (Disclosure of MOT details, request change of parts, etc)

MichaelJSQL
Constraint Violating Yak Guru

252 Posts

Posted - 2014-07-16 : 10:25:48
You can create a database by using CREATE DATABASE <NameOfYourDb>. It will use all the defaults. Then it is just a matter or creating your tables. Only you are going to know what attributes you need, although person and address designs use some pretty standard attributes.

you should start here
http://social.technet.microsoft.com/wiki/contents/articles/12048.introduction-to-database-design-video.aspx

http://social.technet.microsoft.com/wiki/contents/articles/930.how-to-design-create-and-maintain-a-sql-server-database.aspx
Go to Top of Page

menssanvik
Starting Member

3 Posts

Posted - 2014-07-16 : 11:07:08
quote:
Originally posted by MichaelJSQL

You can create a database by using CREATE DATABASE <NameOfYourDb>. It will use all the defaults. Then it is just a matter or creating your tables. Only you are going to know what attributes you need, although person and address designs use some pretty standard attributes.

you should start here
http://social.technet.microsoft.com/wiki/contents/articles/12048.introduction-to-database-design-video.aspx

http://social.technet.microsoft.com/wiki/contents/articles/930.how-to-design-create-and-maintain-a-sql-server-database.aspx




Thanks for that. it is part c and d that is blocking me.

Create a tables for Database with the following:
a) Database to contain a list of people, their addresses, email addresses, and phone numbers.
b) Database to contain a list of cars, their names, their type (2 doors,4 doors, etc.), and their colour.
c) Database to allow only one owner per car
d) Database to allow multiple people to be able to act upon behalf of one car. (Disclosure of MOT details, request change of parts, etc)
Go to Top of Page

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2014-07-16 : 11:19:27
For Part c, create a unique index including the owner id and car id (e.g. VIN)
For Part d, first, create roles for the various actions. Then, grant (only) read privileges to those roles for the tables that have the sensitive data. Revoke any default or public privileges for those tables. Then, add people to the roles. Even better, if you have AD groups set up for these people, you should be able to add the AD group to the role.

Note that all of the part d actions require some level of DBA sophistication. However, there is a stairway series on security on this site

http://www.sqlservercentral.com/stairway/110890/

that I recommend you read if you want/need to do it all yourself
Go to Top of Page

menssanvik
Starting Member

3 Posts

Posted - 2014-07-17 : 07:00:34
Cheers!I've given up -:)
Go to Top of Page
   

- Advertisement -