From 4d0a5c0189e399d9fcc7e8078fb6a14fd243855a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9C=E5=AD=94=E5=87=AF=E8=BE=89=E2=80=9D?= <“2814283821@qq.com”> Date: Sun, 19 Feb 2023 20:48:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20230219 \344\275\234\344\270\232.md" | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 "44 \345\255\224\345\207\257\350\276\211/20230219 \344\275\234\344\270\232.md" diff --git "a/44 \345\255\224\345\207\257\350\276\211/20230219 \344\275\234\344\270\232.md" "b/44 \345\255\224\345\207\257\350\276\211/20230219 \344\275\234\344\270\232.md" new file mode 100644 index 0000000..4b16f63 --- /dev/null +++ "b/44 \345\255\224\345\207\257\350\276\211/20230219 \344\275\234\344\270\232.md" @@ -0,0 +1,59 @@ +~~~mysql +# 作业 + +```sql + +create database test01_market; +create table customers( + c_num int(11), + c_name varchar(50), + c_contact varchar(50), + c_city varchar(50), + c_birth date +); +alter table customers modify c_contact varchar(50) after c_birth; + +alter table customers modify c_name varchar(70); + +alter table customers change c_contact c_phone varchar(50); + +alter table customers add c_gender char(1); +alter table customers modify c_gender char(1) after c_name; + +alter table customers rename to customers_info; +# **要求8:**删除字段c_city +alter table customers drop c_city; +``` + +```sql + +create database test02_library; + +create table books( + b_id int(11) not null primary key comment '书编号', + b_name varchar(50) not null comment '书名', + authors varchar(100)not null comment '作者', + price float not null comment '价格', + prbdate year not null comment '出版日期', + note varchar(100) null comment '说明', + num int(11) not null comment '库存' +); + +insert into books values (1,'Tal of AAA','Dickes',23,1995,'novel',11); +insert into books values (2,'EmmaT','Jane lura',35,1993,'joke',22); +insert into books values (3,'Story of Jane','Jane Tim',40,2001,'novel',0), + (4,'Lovey Day','George Byron',20,2005,'novel',30), + (5,'Old land','Old land',30,2010,'law',0), + (6,'The Battle','The Battle',30,1999,'medicine',40), + (7,'Rose Hood','Rose Hood',28,2008,'cartoon',28); +update books set price=+5 where note = 'novel'; +update books set price=40 where b_name='EmmaT'; +delete from books where num=0; +``` + +```sql + +``` + +~~~ + -- Gitee