Q&A

Q1:How will I know what tables, columns, and properties to have for my database?
A1: Draw a picture of your database to help you see the relationships in the data. Know as much as you can about what you need to accomplish with the database before you even start adding the database and tables. Sample data can often give you ideas about the tables you will need and the constraints on the columns, but in the real world, these aren't set in stone. That's when the ALTER DATABASE and ALTER TABLE commands come in handy.
Q2:What's the difference between a primary key and a foreign key?
A2: The primary key is referenced by a foreign key. The primary key can not be a NULL value. A foreign key can be NULL or it can be linked to the primary key. A table ...

Get Sams Teach Yourself Transact-SQL in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.