国产18禁黄网站免费观看,99爱在线精品免费观看,粉嫩metart人体欣赏,99久久99精品久久久久久,6080亚洲人久久精品

2016年計(jì)算機(jī)二級(jí)mysql數(shù)據(jù)庫(kù)考前模擬試題

時(shí)間:2016-05-31 15:31:00   來源:無憂考網(wǎng)     [字體: ]
(二)代碼題: 要求代碼完整,每錯(cuò)一個(gè)單詞扣一分.每出現(xiàn)一次不匹配的( ) 扣兩分,(總分40分)

  1) 寫代碼創(chuàng)建student數(shù)據(jù)庫(kù) (滿分10)

  數(shù)據(jù)庫(kù)里建立數(shù)據(jù)表student_web

  要求包含以下字段:

  s_id 數(shù)據(jù)類型為整型,非空約束,

  s_name 數(shù)據(jù)類型為可變字符型,長(zhǎng)度12個(gè)字符,保存學(xué)生姓名

  s_fenshu 數(shù)據(jù)類型為整型,

  保存學(xué)生考試成績(jī)

  s_hometown 數(shù)據(jù)類型為可變字符型,長(zhǎng)度50個(gè)字符 保存學(xué)生籍貫

  s_tuition 數(shù)據(jù)類型為整型

  保存學(xué)生學(xué)費(fèi)

  2)寫代碼 向上題所創(chuàng)建好的數(shù)據(jù)表中添加以下三條記錄,(滿分9)

  id : 1    id : 2      id : 3

  姓名: Jack Tomas   姓名: Tom Joe   姓名: Smiths

  成績(jī): 89       成績(jī): 88      成績(jī): 87

  籍貫: 北京豐臺(tái)    籍貫: 天津南開   籍貫: 北京海濱

  學(xué)費(fèi): 2800      學(xué)費(fèi): 3000     學(xué)費(fèi): 2700

  3)寫代碼 返回所有學(xué)生的信息 (滿分3)

  4)寫代碼 返回所有姓名帶J字母的學(xué)生信息!(滿分5)

  5)寫代碼 返回所有北京籍貫的學(xué)生信息 (滿分5)

  6)寫代碼 返回所有學(xué)費(fèi)低于平均學(xué)費(fèi)的學(xué)生信息。提示使用嵌套的select查詢 (滿分8)

  代碼答案:(如下)

  1)

  create database student

  use student

  create table student_web

  (

  s_id int not null,

  s_name varchar(12),

  s_fenshu int,

  s_hometown varchar(50),

  s_tuition int

  )

  2)

  insert into student_web (s_id,s_name,s_fenshu,s_hometown,s_tuition)

  values(1,’Jacktomas’,89,’北京豐臺(tái)’,2800)

  insert into student_web (s_id,s_name,s_fenshu,s_hometown,s_tuition)

  values(1,’TomJoe’,88,’天津南開’,3000)

  insert into student_web (s_id,s_name,s_fenshu,s_hometown,s_tuition)

  values(1,’Smiths’,87,’北京海濱’,2700)

  3)

  select * from student_web

  4)

  select * from student_web where s_name like ’%J%’

  5)

  select * from student_web where s_hometown=’北京%’

  6)

  select * from student_web where s_tuition<(select avg(s_tuition) from s_tuition)