数据库:SQL语句(增删改查)
2016-04-28 13:49
393 查看
简单介绍 ”增删改查“对应的4种SQL语句。
用到的软件: sqlitespy。下载地址:http://download.csdn.net/detail/ss1168805219/9505346
效果图
创建表
primary key autoincrement:主键自动增长
create table students (id integer primary key autoincrement , name text, number text ,age integer)
增
注意:
text:单引号,双引号都表示字符串
4个参数都写全,可以不用写 (name ,number ,age )
insert into students (name ,number ,age ) values('毛泽东','001',100) insert into students (name ,number ,age ) values("朱德",'004',100) insert into students values(10,"朱德",'004',100)
删
delete from students where id = 1
改
“增删改查”4种方法,只有“改”不需要在表明前加修饰词,但是需要在表名后用set。
insert into students,delete from students ,select * from students
update students set name = '毛主席' where id = 2 update students set name = '邓主席' , age = 99 where id = 3
查
where表示条件,多个条件查询用and表示,条件可以用()括起来,也可以不用。 但是“改”的set不可以用()。
select * from students select * from students where id = 10 and name ="朱德" select * from students where (id = 4 and name ="周恩来")
相关文章推荐
- 查询数据库时like和regepx的用法
- Oracle查看连接数、表空间大小及使用率
- mysql主从复制(replication)
- 深入Mysql字符集设置[精华结合]
- mysql提示错误#42000You have an error in your SQL syntax; check the manual that corresponds
- mysql慢查询设置
- mysql 中 character set 与 collation 的点滴理解(collation即比对方法,用于对应字符集的数据集如何排序以及字符串的比对规则)
- Reusing dialogs with a dialog pool--一个sql server service broker例子
- MySql:charset和collation的设置
- MySQL数据库备份
- Oracle 配置transparent gateway(透明网关)连接sqlserver数据库(gateway安装在sqlserver服务器)
- FMDB详解
- 第7讲 SQL语言复杂查询之-Theta-some与Theta-all
- mysqldump备份还原数据库(日常记录)
- CentOS6.5x64采用静默模式安装64位oracle11g
- Oracle使用Mybatis实现List批量插入数据
- Python访问Oracle
- PowerDesigner导出SQL时自动生成注释
- mysql忘记密码的处理方式(整理非原创)
- oracle导入dmp文件命令、sql文件命令, Oracle用户的新增、修改、删除及授权