MySQL資料庫~~一起學習資料庫沖沖沖
- 資料庫操作
- 1.顯示當前資料庫
- 2.創建資料庫
- 3.使用/選中資料庫
- 4.洗掉資料庫
- 資料庫表操作
- 1.創建表
- 2.查看表
- 3.查看表結構
- 4.洗掉表
- 5.表格里面插入內容
- 6.查找資料
資料庫操作
1.顯示當前資料庫
show databases
2.創建資料庫
create database [資料庫名]
舉例:create database day1;
3.使用/選中資料庫
use [資料庫名]
舉例:use day1;
4.洗掉資料庫
drop database [資料庫名]
舉例:drop database day1;
沒事千萬不要使用這個命令,注意啦!
資料庫表操作
在本文中以使用student表為例,使用別的表時,將其替換~
1.創建表
create table student (id int,name varchar(50));
2.查看表
show tables;
3.查看表結構
desc student;
4.洗掉表
drop table student;
不要使用,記住!
5.表格里面插入內容
1.插入一條記錄所有列
insert into student values (1,'tree');
2.一次插入多條記錄
insert into student values
(1,'one'),
(2,'two');
3.一條記錄指定列
insert into student(id,name) values (3,'haha');
6.查找資料
1.select * from student;
* 表示通配符,意思是查找所有的列
2.指定列查找
select id,name from student;
3.查找結果放到運算式
select id+2 from student;
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/296531.html
標籤:其他
上一篇:大資料——Flink Broadcast State 廣播狀態
下一篇:RabbitMq (一)理論篇部分 MQ作用是什么 MQ的優缺點 RabbitMQ的基礎架構 RabbitMQ 五種常用作業模式 RabbitMQ訊息確認機制
