1.創建學生管理系統資料庫xscj
create detabase 資料庫名;

2.打開資料庫
use 資料庫名; //創建資料庫之后,該資料庫不會自動成為當前資料庫需要用use來指定

3.創建表名


4.在表xs中增加“獎學金等級”列 ,并洗掉表中的“姓名”列
alter table 表名
add 列名 ,
drop column 列名;

5.重命名表
alter table 原表名 rename to 新表名;

6.復制表
create table 新表 like 參照表名; //創建一個與參照表相同結構的表,不會復制內容
create table 新表 as (select陳述句); //可以復制表的內容,不會復制索引和完整約束結構

7.洗掉表
drop table if exists 表名;
if exists // 避免洗掉的表不存在時出現錯誤資訊

8.顯示資料庫建立的資料庫檔案
show tables; //顯示已建立的資料表檔案

9.用describe陳述句查看student表的列資訊
describe 表名;

10.查看student表“學號”列的資訊
desc 表名 列名;

轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/121250.html
標籤:MySQL
上一篇:排坑日記之批量從庫IO行程停止
