码迷,mamicode.com
首页 > 数据库 > 详细

数据库基础

时间:2015-04-17 20:29:26      阅读:159      评论:0      收藏:0      [点我收藏+]

标签:

use [0325]  --使用0325数据库
 create table student      --创建表格
 (
   code int primary key identity(1,1) not null,  --列
   name varchar(50)not null,    --列
   sex varchar(50)not null,    --列
   age int not null,          --列
   [weight] int not null,         --列
   hight int not null,       --列
   idno int not null,      --列
   iddress varchar(50) not null,    --列
 )
 go      --连接符
 insert into student values(‘张三‘,‘男‘,18,78,180,371521,‘淄博‘)  --添加表中信息
 insert into student values(‘李四‘,‘女‘,21,55,170,371522,‘济南‘)
 insert into student values(‘王五‘,‘男‘,17,70,178,371523,‘周村‘)
 insert into student values(‘赵六‘,‘女‘,22,50,167,371524,‘北京‘)
 insert into student values(‘田七‘,‘男‘,23,81,175,371525,‘南京‘)
 
 go
 select *from student                                  --查询表中所有数据
 --select *from student where weight >=70 and weight<=80         --查询重量在70到80之间的
 select *from student where weight between 70 and 80       --逻辑语 and or
 select *from student where code=3                           --查询code=3的信息全部显示 *所有信息
 select name,sex  from student where code=3                --查询只显示code=3的需要信息
 select *from student where name like‘王%‘                --%任意字符长度 
 
 update student set name=‘赵丹‘where name=‘赵六‘        --update修改 
 
 delete from student where code = 2             --删除一行信息
 

 

数据库基础

标签:

原文地址:http://www.cnblogs.com/Mr-xue/p/4435805.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!