SQL Server 實驗三 表資料的插入 修改

2021-10-07 08:29:26 字數 4292 閱讀 7833

這是乙個系列,需幾個文件一起看

create

table employees

( employeeid char(6

)primary

keynot

null

, name varchar(6

)not

null

, education varchar(4

)not

null

, birthday datetime

notnull

, *** bit

notnull

default1,

workyear tinyint

null

, address varchar(40

),phonenumber char(12

)null

, departmentid char(3

)not

null

)insert

into employees values

('000001'

,'王林'

,'大專'

,'1966-01-23',1

,8,'中山路32-1-508'

,'83355668',2

);insert

into employees values

('010008'

,'伍容華'

,'本科'

,'1976-03-28',1

,3,'北京東路100-2'

,'83321321',1

);insert

into employees values

('020010'

,'王向容'

,'碩士'

,'1982-12-09',1

,2,'四牌樓10-0-108'

,'83792361',1

);insert

into employees values

('020018'

,'李麗'

,'大專'

,'1960-07-30',0

,6,'中山東路102-2'

,'83413301',1

);insert

into employees values

('102201'

,'劉明'

,'本科'

,'1972-10-18',1

,3,'虎距路100-2'

,'83606608',5

);insert

into employees values

('102208'

,'朱駿'

,'碩士'

,'1965-09-28',1

,2,'牌樓巷5-3-106'

,'84708817',5

);insert

into employees values

('108991'

,'鍾敏'

,'碩士'

,'1979-08-10',0

,4,'中山路10-3-105'

,'83346722',3

);insert

into employees values

('111006'

,'張石兵'

,'本科'

,'1974-10-01',1

,1,'解放路34-1-203'

,'84563418',5

);insert

into employees values

('210678'

,'林濤'

,'大專'

,'1977-04-02',1

,2,'中山北路24-35'

,'83467336',3

);insert

into employees values

('302566'

,'李玉珉'

,'本科'

,'1968-09-20',1

,3,'熱和路209-3'

,'58765991',4

);insert

into employees values

('308759'

,'葉凡'

,'本科'

,'1978-11-18',1

,2,'北京西路3-7-52'

,'83308901',4

);insert

into employees values

('504209'

,'陳林琳'

,'大專'

,'1969-09-03',0

,5,'漢中路120-4-12'

,'84468158',4

);create

table departments

( departmentid int

notnull

primary

keyidentity(1

,1),

departmentname char(20

)not

null

, note varchar

(100

)null

)set

identity_insert departments on

--重要修改

insert

into departments (departmentid, departmentname, note)

values(1

,'財務部'

,null),

(2,'人力資源部'

,null),

(3,'經理辦公室'

,null),

(4,'研發部'

,null),

(5,'市場部'

,null);

create

table salary

( employeeid char(6

)primary

keynot

null

, income float

notnull

, outcome float

notnull,)

insert

into salary values

('000001'

,2100.8

,123.09

)insert

into salary values

('010008'

,1582.62

,88.03);

insert

into salary values

('102201'

,2569.88

,185.65);

insert

into salary values

('111006'

,1987.01

,79.58);

insert

into salary values

('504209'

,2066.15

,108.0);

insert

into salary values

('302566'

,2980.7

,210.2);

insert

into salary values

('108991'

,3259.98

,281.52);

insert

into salary values

('020010'

,2860.0

,198.0);

insert

into salary values

('020018'

,2347.68

,180.0);

insert

into salary values

('308759'

,2531.98

,199.08);

insert

into salary values

('210678'

,2240.0

,121.0);

insert

into salary values

('102208'

,1980.0

,100.0

)select

*from dbo.departments

select

*from dbo.employees

select

*from dbo.salary

sqlserver資料庫實驗一

1.一些sql語法sqlserver並不支援 2.當用insert插入date型資料的時候,要用單引號括起來 values 2012 10 1 3.增加乙個新的字段 alter table 表名稱 add 欄位名 字段型別 null not null 4.更新字段 update 表名稱 set 欄位...

實驗三 線性表綜合實驗 順序表

一 實驗目的 鞏固線性表的資料結構的儲存方法和相關操作,學會針對具體應用,使用線性表的相關知識來解決具體問題。二 實驗內容 建立乙個由 n 個學生成績的順序表,n 的大小由自己確定,每乙個學生的成績資訊由自己確定,實現資料的對錶進行插入 刪除 查詢等操作。分別輸出結果。用順序表實現 ifndef s...

實驗三 資料操縱

student stuno,stuname,stu sbirthday,dno,classno,tel,native,address course couno,couname,semester,credit,lecture,experiment sc stuno,couno,grade dept d...