Database Development and Implementation Lesson
Database Development and Implementation Lesson
DEVELOPMENT AND
IMPLEMENTATION
BOANSI, KUFUOR OLIVER
SQL PROGRAMMING
• Remember these about SQL:
• Show Databases;
• To select the Accomodation database for use, the query would be:
• Use Accomodation;
• UNIQUE (Address)
DEFAULT CONSTRAINT
• This constraint is used to provide a default value for a column if no
value is entered. The syntax is:
• ColumnName datatype DEFAULT ‘value’
• Example: To make the default value for a column called “Region” Volta
Region, the query will be:
• Region varchar(20) DEFAULT ‘Volta Region’;
CHECK CONSTRAINT
• This constraint is used to limit the value range that can be placed in a
column.
• EXAMPLE: To accept ages greater than or equal to 20 years in the Age
column of a table, the syntax would be:
• Age int NOT NULL,
• Check (Age>=20)
• The FOREIGN KEY clause specifies the columns in the child table that refers
to primary key columns in the parent table
• NO ACTION
• RESTRICT
• These two(NO ACTION and RESTRICT rejects deletion and updates)
ACTIVITIES
• CREATE A DATABASE CALLED “OBSHOPRITE”
• CREATE THE TABLES IN THE DIAGRAM WITH ALL THEIR ATTRIBUTES
• CHOOSE APPROPRIATE DATA TYPES FOR THE ATTRIBUTES
• IN THE CUSTOMER TABLE, MAKE THE DEFAULT VALUES FOR CITY AND
COUNTRY “JASIKAN” AND “GHANA” RESPECTIVELY
• IN THE ORDER TABLE, MAKE THE DEFAULT VALUE FOR COMMENT,
“NO COMMENT”
• ENFORCE THE CONSTRAINT THAT WILL ENSURE THAT UPON
DELETION, THE CHANGE WILL AFFECT BOTH THE CHILD AND PARENT
IMPLEMENT THIS
ASSIGNMENT
• PRODUCE A TWO PAGE REPORT ON MySQL STORAGE ENGINES OR
TABLE TYPES