【MySQL作业】DDL 和 DML——美和易思使用 DDL 定义数据库表结构应用习题

点击打开所使用到的数据库>>>


1、使用 DDL 创建 easyShopping2 数据库。

create database easyShopping2

2、使用 DDL 更改 easyShopping2 数据库的名字为 easyShopping3。

rename database easyShopping2 to easyShopping3

3、使用 DDL 删除数据库 easyShopping3。

drop database easyShopping3

4、使用 DDL 创建商品表和客户表

商品表:

create table goods(  --商品表
    goodsID int primary key auto_increment, 
    goodsCode varchar(20) unique not null,
    goodsName varchar(50) not null, 
    category varchar(20) default null,
    unitPrice decimal(8,2) default null, 
    areaID int default null,
    saleCount int default null
);

客户表:

create table customer(  --客户表
    customerID int primary key auto_increment, 
    loginID varchar(20) unique not null,
    pwd varchar(10) not null,
    cName varchar(20) not null, 
    city varchar(20) default null,
    address varchar(50) default null, 
    phone varchar(20) default null
);

 

>>知识点【第3章 DDL 和 DML】

 

原创文章 120 获赞 215 访问量 35万+

猜你喜欢

转载自blog.csdn.net/weixin_44893902/article/details/105751570