首页 > 数据库技术 > 详细

SQL语句入门

时间:2015-03-21 15:23:05      阅读:299      评论:0      收藏:0      [点我收藏+]

e1、数据库

创建数据库:CREATE DATABASE student_teacher;

删除数据库:DROP DATABASE student_teacher;

2、表

创建表:CREATE TABLE student;

删除表:DROP TABLE student;

增加一列:Alter table student add column name char;

3、视图

创建视图:create view stu;

删除视图:drop view stu;

4、简单表数据操作语句

选择:select * from student where no=091120109;

插入元组:insert into student(no,num,sex,grade) values(1,091120109,male,98);

删除元组:delete form student where sex=male;

更新字段属性的值:update student set sex=female where sex=male;

模糊查找:select * from student where num like “%911201%”; //%代表任意的零个或多个字符,’_’表示任意单个字符。

排序(DESC为降序,ASC为升序):select *from student order by num [DESC];

SQL语句入门

原文:http://www.cnblogs.com/joeshine/p/4355500.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!