数据库的一些基本操作
来源:互联网 发布:360数据恢复大师损坏 编辑:程序博客网 时间:2024/05/05 06:49
update tablename set column=value where column=value
首先以王珊老师的《数据库系统概论》为例(毕竟是经典中的经典),建三个简单的表,其中构成有连接的关系。
只写一个建表语句吧。
create table student(sno int(10) auto_increment primary key not null,sname varchar(5),ssex varchar(2),sage int(3))
学生表如上
create table course(cno int(10) auto_increment primary key not null,cname varchar(5),cxuefen int(3))
课程表如上
create table student(sno int(10) primary key not null,cno int(10) primary key not null,grade int(3))
学生课程表如上
foreign key (sno) reference (student.sno)之类的
我猜应该是没有问题的!!!
但是应该是添加外间约束的 foreign key!!!
然后是普通的增删改查
然后貌似在mysql中一般是不区分大小写的,可以自己设置!
增加:
insert into tablename (column1,column2,column3) values(value1,value2,value3)
删除:
delete from tablename where column=value
查询:
select tablename.column,..... from tablename
更新:
update tablename set column=value where column=value
然后就是开始函数了
因为1=1是恒真式,所以写条件表达式的时候要好好利用这个表达式1=1
比如我们在拼接查询语句的时候为了避免报错可以首先拼接恒真式
select sno,sname,sdept where 1=1,后面的条件
阅读全文
0 0
- 一些数据库的基本操作
- 数据库的一些基本操作
- 数据库一些基本操作
- sql2005对数据库的一些基本操作
- 关于oracle数据库的一些基本操作
- MongoDB数据库的一些常用基本操作
- SQL server数据库的一些基本操作
- 数据库的基本操作之一些基本语句
- 数据库中的一些基本操作
- CodeIgniter的中的一些基本数据库操作的demo
- 数据库中对表的一些基本操作
- 【数据库】创建表以及一些基本的表操作
- C#数据库的一些基本操作 第一篇
- EF CodeFirst关于数据库的一些基本操作
- MySQL数据库的一些基本操作及注释
- 用cmd命令行操作数据库的一些基本命令。
- 关于使用PDO连接数据库的一些基本操作
- 数据库的基本操作
- java加密与解密的艺术(七)——因电子邮件传输诞生的Base算法家族
- auto_ptr、shared_ptr、weak_ptr、scoped_ptr用法小结
- 微信支付红包Java
- DAG上的动态规划
- Spring 自定义对象初始化及销毁
- 数据库的一些基本操作
- 面试:----面试中遇到的问题
- IDEA 12 + tomcat 进行远程调试
- IntelliJ IDEA 远程部署tomcat应用
- ASP.NET中获取字符串的MD5码
- android 资源图片加密
- typedef用法及注意
- 使用图片服务器FastDFS实现图片上传
- Python内建函数之——filter,map,reduce