1: | What different types of relationships can you represent in a table? |
A1: | You can have one-to-one, one-to-many, and many-to-many relationships represented in a table. |
2: | Where are foreign keys defined? |
A2: | Foreign keys are defined on the dependent table and rely on the data in the parent table. A foreign key references a primary key or a unique key in the same or another table. A foreign key assignment indicates that referential integrity is to be maintained according to the specified referential constraints. |
3: | Why should you normalize your tables? |
A3: | You should normalize your table to avoid redundancies and inconsistencies in your data. |
4: | Is it a good idea to use a phone number as a primary key? Why or why not? |
A4: | Using a phone number as a primary key isn't a great idea, mainly because a phone number may not be unique (you may have several people sharing a phone, for example). Also, phone numbers change as people move or if the phone company needs to change the area code. |
5: | What data types should be used for data such as photos or movies? |
A5: | GRAPHIC and BLOB data types are meant for binary data such as photos and movies. |
6: | What is the difference between data types CHARACTER and VARCHAR? |
A6: | The VARCHAR and CHARACTER data types hold the same types of data, but VARCHAR is more efficient. Suppose that you create two 10-character columns, defining one column as VARCHAR and the other as CHARACTER. Ten bytes are reserved for the CHARACTER column regardless of the data inserted into the column. For the VARCHAR column, only the amount of space required to store the data is used for the column. CHARACTER columns are a fixed-length and can contain up to 254 bytes per column. VARCHAR columns are variable-length and can contain up to 4,000 bytes per column. |
No comments:
Post a Comment