关于MySQL数据库的简单操作
2018-11-28 本文已影响0人
FightHawk
一、前言
需要工具:
Nevicat Premium
可以使用的电脑
mysql
(说明:这是在Windows系统上进行操作的……)
二、正文
1.首先利用Nevicat Premium新建两个表,如图所示:


2.MySQL语句的简单应用:
查询:
SELECT stuID,stuName FROM `student_info`

搜索列中的指定模式:
SELECT DISTINCT stuID, stuName
FROM student_info
WHERE stuID LIKE '14%';

排序:
SELECT stuID,stuName
FROM student_info
ORDER BY stuID;

增加数据:
INSERT INTO student_info
VALUES (21,1111,"韩王");


删除一行数据:
DELETE FROM lesson_info
WHERE ID=06;


修改一行数据:
UPDATE student_info
SET stuID=1616,stuName='MF'
WHERE id='02';


匹配:
SELECT stuName,stuID
FROM student_info
RIGHT JOIN lesson_info
ON student_info.ID=lesson_info.ID
