1、DDL (data define language) 包含 create drop alter
2 DML (data manipulation language) 包含 select update delete insert
3.DCL (data control language) 包含 commit rollback grant revoke
关键字不区分大小写,win 字段名称和表明不区分大小写
练习题及对应答案
1
编写一条 CREATE TABLE 语句,用来创建一个包含表 1-A 中所列各项的表 Addressbook (地址簿),并为 regist_no (注册编号)列设置主键约束
表1-A 表 Addressbook (地址簿)中的列
create table Addressbook(
regist_no INTEGER not null,
name varchar(128) not null,
address varchar(256) not null,
tel_no char(10),
mail_address char(20),
primary key(regist_no));
2.
假设在创建练习1.1中的 Addressbook 表时忘记添加如下一列 postal_code (邮政编码)了,请把此列添加到 Addressbook 表中。
列名 : postal_code
数据类型 :定长字符串类型(长度为 8)
约束 :不能为 NULL
alter table addressbook add column postal_code char(8) not null;
3
编写 SQL 语句来删除 Addressbook 表。
drop table addressbook ;