1.安裝
2.資料庫檔案
3.資料庫操作
(1)建立 create database a;
(2)檢視 show databases;
(3)使用 use a;
(4)刪除 drop database a;
管理表一、表結構
1.建立表
列描述:列名 資料型別 是否為空
create table student
(sno char(11),
sname char(20),
sage int,
s*** char(2));
create table sc
(sno char(11) not null,
cno char(4) not null,
grade int);
2.修改表 alter table 表名
(1)新增列
alter table student
add tel char(11);
alter table student
add dno char(2);
(2)修改列
alter table student
modify tel char(13);
(3)刪除列
alter table student
drop column tel;
3.刪除表
drop table sc;
4.檢視表
(1)檢視當前資料庫下有哪些表 show tables;
(2)檢視表的結構 desc student;
課前練習
1.建立表course p8,只包括課程號和課程名
2.檢視course表的結構
3.新增列:beizhu 資料型別自擬;
4.修改列cname 長度為30;
5.刪除beizhu列
6.刪除course表
二、表資料
1.插入資料 insert
insert into 表名
values(,)
insert into sc
values(『0101』,『c01』,90);
說明*字元型和日期時間型 用 『』
**所提供的資料或者與表的列一一對應,或者與所提供的列清單一一對應;
insert into student(sno,sname)
values(『0103』,『程銘』);
2.更新資料update
update 表名
set 列名 =
where 行
update student
set s*** = 『女』
where sno = 『0103』;
3.刪除資料 delete
delete from 表名
where
delete from student
where sname = 『程銘』;
4.查詢資料 select
MySQL資料庫 資料庫管理
建立使用者,指定明文密碼 create user rose localhost identified by rosepwd 檢視使用者是否建立成功 select user,host from mysql.user 建立使用者,不設定密碼 create user rose01 localhost se...
SQL資料庫 管理資料庫
建立完資料庫,如何對它進行管理呢?管理資料庫包括對資料庫修改大小 新增資料檔案或日誌檔案 分離和附加資料庫等,同樣有語句和ssms兩種方法。接下來主要展示用sql語句方法更改,用介面的方式只需要在屬性裡更改就可以 將乙個新的事務日誌檔案xscjl log,初始大小100mb加入xscj中。alter...
管理資料庫
資料庫是乙個複雜的物件,每個rdbms 產品都有其獨特的管理和儲存內部資料的方式。建立資料庫的任務可以是最基本的,也可以是很複雜的,它取決於專案的實際需要以及所選用的資料庫管理系統。建立和使用資料庫 create database 資料庫名 第乙個字元必須是下列字元之一 unicde 標準 3.0所...