阿里云天池task01

本笔记为阿里云天池龙珠计划SQL训练营的学习内容,链接为https://tianchi.aliyun.com/specials/promotion/aicampsql

 

3.1编写一条 CREATE TABLE 语句,用来创建一个包含表 1-A 中所列各项的表 Addressbook (地址簿),并为 regist_no (注册编号)列设置主键约束

表1-A 表 Addressbook (地址簿)中的列

create table Addressbook
(
regist_no int not null primary key,
name varchar(128) not null,
address varchar(256) not null,
tel_no char(10),
mail_address char(20)
);

3.2假设在创建练习1.1中的 Addressbook 表时忘记添加如下一列 postal_code (邮政编码)了,请把此列添加到 Addressbook 表中。

 

列名 : postal_code

 

数据类型 :定长字符串类型(长度为 8)

 

约束 :不能为 NULL

alter table Addressbook add postal_code char(8) not null;


3.3编写 SQL 语句来删除 Addressbook 表。
truncate Addressbook;

 

3.4编写 SQL 语句来恢复删除掉的 Addressbook 表。
重新创建

posted @ 2022-06-21 20:28  灵缘  阅读(30)  评论(0)    收藏  举报