1..建立教學管理「jxgl」資料庫。
在查詢窗格中輸入如下命令,然後單擊「執行」鈕執行該命令。
create database jxgl;
create table student
( sno char(5) not null unique,
sname char(20)not null unique,
s*** char(1),
sage int,
sdept char(20));
insert into student values(『95001』,』李勇』,』m』,20,』cs』);
2.分別執行以下命令,檢視student、course和sc資料表中的內容。
select * from student;
select * from course;
select * from sc;
8.修改資料表結構。
①向student表增加「入學時間」列,其資料型別為日期型,用select命令檢視表中內容。
alter table student add scome datetime;
select * from student;
②刪除「入學時間」列,再用select命令檢視表中內容。
alter table student drop column scome;
select * from student;
9.刪除資料表。
drop table sc;
drop table student;
drop table course;
資料庫 資料庫基本操作
操作練習 修改表結構 表資料的操作 實現 1 建立表 create table student stu no char 12 not null primary key,stu name varchar 20 not null gender tinyint 1 default1,age tinyint...
資料庫基本操作
1.查詢一周之內的資料 select from 表名 where date sub curdate interval 7 day date 欄位名 2.插入 年 月 日 時 分 秒的時間 pstmt.settimestamp 7,new timestamp system.currenttimemil...
資料庫基本操作
登入資料庫系統 mysql h localhost u root p 檢視已存在的資料庫 show databases 檢視預設儲存引擎 show variables like storage engine 建立資料庫 create database 想建立的資料庫名字 刪除資料庫 drop dat...