1 / 12

Quiz for the day 1. given a field definition code char(1)

Quiz for the day 1. given a field definition code char(1) What is the domain of code? Assume that you can enter data from a QWERTY keyboard. Explain in words or enumerate.

lundy
Télécharger la présentation

Quiz for the day 1. given a field definition code char(1)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Quiz for the day 1. given a field definition code char(1) What is the domain of code? Assume that you can enter data from a QWERTY keyboard. Explain in words or enumerate. 2. T/F as long as the name of the foreign key is the same as the name of the primary key in the associated table, the data types don’t matter

  2. Another example - Entity-Relationship Diagram (ERD) Student Class Enrol seuID (PK) (FK) dept (PK) (FK) number (PK) (FK) semester (PK) section grade … Some sample records: 111 cosc 3337 SP13 01 cosc 3337 DBMS 111 Jill Student 222 cosc 3337 SP13 01 culf 3331 Amer. D 222 Joe Student 111 culf 3331 SP13 03 How about 111 chem 1301 SP13 02 seuID (PK) fname lname … dept(PK) number (PK) Title …

  3. Integrity Notes from http://www.databasedev.co.uk/database_normalization_process.html • There are 4 types of data integrity: • Entity Integrity ensures that each row (record) is a unique instance in a particular table by enforcing the integrity of the primary key or the identifier column(s) of a table (e.g. ID, Reference Code, etc). • Tool: Primary key Do you know everything there is to know about PK?

  4. Integrity Notes • Domain Integrity ensures validity of entries (data input) for a column through the data type, the data format and the range of possible values (e.g. date, time, age, etc.). • seuID int(6) what is the domain? • gender enum(‘F’, ‘M’); • Application program?

  5. Integrity Notes Referential Integrity preserves the defined relationships between tables when records are added, modified or deleted by ensuring that the key values are consistent across tables; such consistency requires that there are no references to non-existent values and if a key value changes, all references to it change consistently through database, otherwise a key value cannot be changed. constraint foreign key (seuID) references student(seuID) on update cascade on delete cascade

  6. constraint foreign key (seuID) references student(seuID) on update cascade on delete cascade constraint foreign key (seuID) references student(seuID) on update restrict on delete set null Oh man – Parent / Child do I really understand 1 - M

  7. Integrity Notes User-Defined Integrityenables specific (required) business rule(s) to be defined and established in order to provide correct and consistent control of an application's data access (e.g. who can have permissions to modify data, how generated reports should look like, which data can be modified, etc.) Application programs Example: if your web page gathers data and updates the database, can you put audits in your program to make sure that what you ask the database to update/insert meets the business rules set up? The RDBMS can help a lot but it can’t do everything

  8. Surrogate / natural primary keys. CardinalityOptionalitycolumn ordering – what is that about? Data types – see link on website

  9. sql create database, table, user drop insert update delete select alter table show status

  10. sql describe use grant revoke data types

  11. sql primary key constraint foreign key on update on delete unique default not null

  12. sql index

More Related