3.DML
-- 指定字段名添加
insert into dept(depid,depname,peoplecount)values('p10’,’人力部’,,15),(‘p20’,’研發(fā)部’,50);
-- 不指定字段名添加
insert into dept values
('p10’,’人力部’,15),(‘p20',’研發(fā)部’,50);
-- 查看默認(rèn)安全路徑
show variables like ‘%secure%'
-- 為 Monthly Indicator 表導(dǎo)入外部 txt 文件
load data infile ‘c:/ProgramData/MySQL/MySQL Server 8.0/Uploads/xx.txt'
into table Monthly Indicator
fields terminated by ‘\ t’
[ignore l lines];
-- 檢查導(dǎo)入內(nèi)容 Monthly Indicator
select * from Monthly Indicator;
-- 檢查導(dǎo)入數(shù)據(jù)總行數(shù) Monthly Indicator
select count(x) from Monthly Indicator;
-- 檢查表結(jié)構(gòu)
desc Monthly Indicator;
--將部門 ID為 p01的信息單獨(dú)保存到 department 表中
create table department as
select depid,depname,peoplecount
from dept
where depid='p01';
-- 將 dept 表中編號(hào)為 p11 的部門名稱修改為后勤部
update dept set depname='后勤部 where depid='p11';
-- 刪除 p20 部門的員工記錄
delete from dept where depid=p20;
-- 刪除所有的員工記錄
delete from dept;
truncate dept;








暫無(wú)數(shù)據(jù)