1. 程式人生 > 實用技巧 >終章實驗七

終章實驗七

MySQL總覽

MySQL常見命令

資料庫操作

1、登入資料庫
mysql -uroot -proot

2、檢視所有資料庫
show databases;

3、建立資料庫
create database Gwen_liu;

4、選擇一個數據庫
use test;

5、顯示錶
show tales;

6、建立資料庫表
create table math(
id int,
name varchar(20)
);

7、查看錶的結構
desc math;

8、簡單查詢
select avg(salary), department_id
from employees
where email like '%a%'
group by department_id

9、插入資料,記錄
insert into math (id, name) values (1, 'Gwen');

10、刪除記錄
delete from math where id = 1;

11、更新、修改資料
update math set name="Gwen" where id=1;

12、刪除資料表
drop table math;

13、檢視mysql版本
select version();