MySQL 的相关语句(增删改查)(SQLyog软件实现)(2)

-- 创建学生信息表 student
CREATE TABLE student(
    sid        INT,        -- 学号
    sname        VARCHAR(20),    -- 姓名
    age        INT,        -- 年龄
    scores        INT,        -- 成绩
    gender        VARCHAR(6),    -- 性别
    birthday    DATE        -- 出生日期
);

-- 添加数据
INSERT INTO student(sid,sname,age,scores,gender) VALUES (0001,'张华',23,49,'女');
INSERT INTO student(sid,sname,age,scores,gender,birthday) VALUES (0007,'孙萌',20,59,'女','1997-02-24');
INSERT INTO student(sid,sname,age,scores,gender) VALUES (0002,'李四',28,69,'男');
INSERT INTO student(sid,sname,age,scores,gender,birthday) VALUES (0009,'吴笑清',22,68,'女','1994-11-02');
INSERT INTO student(sid,sname,age,scores,gender) VALUES (0003,'王小花',26,29,'女');
INSERT INTO student(sid,sname,age,scores,gender,birthday) VALUES (0004,'赵六',22,85,'男','1990-12-17');
INSERT INTO student(sid,sname,age,scores,gender,birthday) VALUES (0005,'钱雨',21,87,'女','1992-03-30');
INSERT INTO student(sid,sname,age,scores,gender,birthday) VALUES (0006,'李四',25,83,'男','1996-05-13');
INSERT INTO student(sid,sname,age,scores,gender,birthday) VALUES (0008,'周董',27,99,'男','1995-07-23');
INSERT INTO student(sid,sname,age,scores,gender,birthday) VALUES (00010,'郑源',27,79,'男','1994-08-23');

-- 查询所有列
SELECT * FROM student;

-- 删除表 student
DROP TABLE student;

-- 去除重复记录
SELECT DISTINCT * FROM student;

-- 显示mydb下的所有表
USE mydb; SHOW TABLES;

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/ae8d95958cb555b0cf8bd80dc8636fc8.html