Week 8
Week 8
Language
Week 8
Recap
• In the previous lesson, we discussed:
• SQL
• The categories of SQL commands
• SQL statement to define database structures
Recap – syntax
• Create a database
• CREATE database databasename;
CREATE TABLE
CREATE TABLE TableName
( AttributeName Domain [ Constraint ] ........
AttributeName Domain [ Constraint ] [ OtherConstraints ] );
Recap -syntax
• Alter table
ALTER TABLE table_name ADD column_name column-definition;
ALTER TABLE table_name MODIFY column_name column_type;
ALTER TABLE table_name
RENAME COLUMN old_name to new_name;
Recap
• Drop a database
DROP DATABASE database_name;
• Drop a table
DROP TABLE table_name;
• TRUNCATE TABLE table_name;
Recap Activity
• Given the values for the attributes,
what datatypes can you assign for
each of the given attributes
• Create this table, Student
• We will use this table for
illustrations in this lesson.
Objectives
• By the end of this lesson, students should be able to:
• Understand the DML commands
• Write DML statements to manipulate database objects
• Use the SELECT command
• Use appropriate operators to manipulate the database objects
Data Manipulation Language
DELETE FROM table_name WHERE condition;