2016年11月14日--SQL创建数据库、表-查、插、删、改
--创建数据库(create database 数据库名)
create database hq20161114
go
--使用选择数据库(use 数据库名)
use hq20161114
go
--创建学生表(create table 表名( 列名 列类型,列名 列类型……) )
create table xuesheng
(
code int,
name varchar(10),
sex char(10),
chengji decimal(18,2)
)
--添加学生信息(insert into 表名 values(第一列数据,第二列数据, …… ,第N列数据) )
insert into xuesheng values(1001,'一','男',11)
insert into xuesheng values(1002,'二','男',22)
insert into xuesheng values(1003,'三','女',33)
insert into xuesheng values(1004,'四','女',44)
go
--查询表内所有数据(select * from 表名)
select * from xuesheng
--查询数据指定单列(select 列名 from 表名)
select name from xuesheng
--查询数据指定多列(select 列名1,列名2,……,列名N from 表名)
select name,chengji from xuesheng
--根据条件进行查询 成绩大于20的 (select * from 表名 where 列名+关系运算符+值)
select * from xuesheng where chengji>=20
--根据条件进行查询 女同学的成绩(select 要显示的列名1,列名2……列名n from 表名 where 列名+关系运算符+值)
select chengji from xuesheng where sex='女'
--修改3号学生性别改为男(update 表名 set 列名=值 where 列名+关系运算符+值)
update xuesheng set sex='男' where code=1003
--全部删除(delete from 表名)
delete from xuesheng
--添加5号学
insert into xuesheng values(1005,'五','女',55)
--删除指定行(delete from 表名 where 列名+关系运算符+值)
delete from xuesheng where name='五'
2016年11月14日--SQL创建数据库、表-查、插、删、改的更多相关文章
- 2016年11月14日 星期一 --出埃及记 Exodus 20:5
2016年11月14日 星期一 --出埃及记 Exodus 20:5 You shall not bow down to them or worship them; for I, the LORD y ...
- 2016年11月17日--SQL主、外键,子查询
主键 数据库主键是指表中一个列或列的组合,其值能唯一地标识表中的每一行.这样的一列或多列称为表的主键,通过它可强制表的实体完整性.当创建或更改表时可通过定义 PRIMARY KEY约束来创建主键.一个 ...
- 2016年11月23日 星期三 --出埃及记 Exodus 20:14
2016年11月23日 星期三 --出埃及记 Exodus 20:14 "You shall not commit adultery.不可奸淫.
- 本周MySQL官方verified/open的bug列表(11月8日至11月14日)
本周MySQL verified的bug列表(11月8日至11月14日) 1. Bug #70859-DWITH_EXAMPLE_STORAGE_ENGINE=1 is ignored URL ...
- 2016年12月14日 星期三 --出埃及记 Exodus 21:9
2016年12月14日 星期三 --出埃及记 Exodus 21:9 If he selects her for his son, he must grant her the rights of a ...
- 2016年11月30日 星期三 --出埃及记 Exodus 20:21
2016年11月30日 星期三 --出埃及记 Exodus 20:21 The people remained at a distance, while Moses approached the th ...
- 2016年11月29日 星期二 --出埃及记 Exodus 20:20
2016年11月29日 星期二 --出埃及记 Exodus 20:20 Moses said to the people, "Do not be afraid. God has come t ...
- 2016年11月28日 星期一 --出埃及记 Exodus 20:19
2016年11月28日 星期一 --出埃及记 Exodus 20:19 and said to Moses, "Speak to us yourself and we will listen ...
- 2016年11月27日 星期日 --出埃及记 Exodus 20:18
2016年11月27日 星期日 --出埃及记 Exodus 20:18 When the people saw the thunder and lightning and heard the trum ...
随机推荐
- WinRAR压缩
WinRAR压缩软件: ------------------ 软件官网:http://www.winrar.com.cn/ -------------------------------
- 数据库SQL语句学习--view
1.新建一个view create view view_name as select * from table_name where... 2.删除一个view drop view view_name ...
- js blind使用
$("#music_up").bind("click",showData()); $("#music_up").bind("cli ...
- *** Assertion failure in -[UICollectionView _dequeueReusableViewOfKind:withIdentifier:forIndexPath:viewCategory
报错提示: *** Assertion failure in -[UICollectionView _dequeueReusableViewOfKind:withIdentifier:forIndex ...
- php常用时间戳记录
<?php echo '<br/>'; //php获取今日开始时间戳和结束时间戳 echo "今天"; echo '<br/>'; $beginTod ...
- ASP.NET WebAPI 08 Message,HttpConfiguration,DependencyResolver
ASP.NET WebAPI 08 Message,HttpConfiguration,DependencyResolver Message WebAPI作为通信架构必定包含包含请求与响应两个方法 ...
- js的元素对象
元素对象(element对象) ** 要操作element对象,首先必须要获取到element, - 使用document里面相应的方法获取 ...
- FMDB 多线程使用
在App中保持一个FMDatabaseQueue的实例,并在所有的线程中都只使用这一个实例. [FMDatabaseQueue databaseQueueWithPath:path]; FMDatab ...
- 【转】快速理解Kafka分布式消息队列框架
from:http://blog.csdn.net/colorant/article/details/12081909 快速理解Kafka分布式消息队列框架 标签: kafkamessage que ...
- git如何撤销合并
撒销一个合并 如果你觉得你合并后的状态是一团乱麻,想把当前的修改都放弃,你可以用下面的命令回到合并之前的状态: $ git reset --hard HEAD 或者你已经把合并后的代码提交,但还是想把 ...