|
本题添加时间:2023/7/3 22:20:00 |
|
圆梦客服:王老师 19139051760(微信同号) 19139051760(微信同号) |
4.数据库company中有如下两张表 表offices(office_code, city, address, country, postal_code)office_code为主键, 表employees(employee_number, name, mobile, office_code, job_title, note, gender),employee_number为主键且自增. (1)创建数据库company,写出创建语句; (2分)
(2)创建表offices和employees,写出创建语句;(8分)
(3)将表employees的mobile字段修改到office_code字段后面;(3分)
(4)修改表employees的gender字段,数据类型为CHAR(1),非空约束;(3分)
(5)给表employees增加字段名favoriate_activity,数据类型为VARCHAR(100);(4分)
|
答案是:(1)创建数据库company,写出创建语句; (2分) 答案: CREATE DATABASE company; (2)创建表offices和employees,写出创建语句;(8分) 答案: CREATE TABLE offices( Office_code int(10) not null, city varchar(50), address varchar(50), country varchar(50), postal_code varchar(15) PRIMARY KEY (office_code) );
CREATE TABLE employees( Employee_number INT(10) NOT NULL PRIMARY KEY AUTO_INCREMENT, name VARCHAR(50), mobile VARCHAR(25), office_code INT(10), job_title VARCHAR(50), note VARCHAR(255), gender VARCHAR(5), ); (3)将表employees的mobile字段修改到office_code字段后面;(3分) 答案: ALTER TABLE employees MODIFY mobile VARCHAR(25) AFTER office_code; (4)修改表employees的gender字段,数据类型为CHAR(1),非空约束;(3分) 答案: ALTER TABLE employees MODIFY gender CHAR(1) NOT NULL; (5)给表employees增加字段名favoriate_activity,数据类型为VARCHAR(100);(4分) 答案: ALTER TABLE employees ADD favoriate_activity VARCHAR(100);
出自
国家开放大学数据库运维 国家开放大学系统
河南大学
|
更多试题>>>>
1、请回答以下几个问题:
(1)数据库运维的目标是什么?(3分)
(2)数据库运维的核心任务是什么?(3分)
(3)MySQL数据库运维的五大指标具体是什么?(10分)
2、登录root账户创建普通账户并给普通账户授权:
(1) 创建一个密码为“123456”的普通用户账户“databasenormal”; (2分)
(2) 创建名为student的数据库;(2分)
3、1.仓库业务中,一个仓库数据库包括如下三张表:
仓库表warehouses(wid,name,area),wid是主键
零件表compnents(cid,name,mode,unit,price),cid为主键
组装表stores(w
4、使用truncate语句清空代理商表A中的数据,模拟误操作 (5分)利用(2)备份的数据文件,恢复代理商表A中的数据 (5分)
5、数据库CAP下有如下几张表:
顾客表:C(cid,cname,city,discnt)
商品表:P(pid,pname,city,quantity,price)
代理商表:A(aid,aname,city,pe
|
|