跟燕十八学习PHP-第二十一天-mysql添加数据

 

/**
燕十八 公益PHP培训
课堂地址:YY频道88354001
学习社区:www.zixue.it
**/

create table class(
id int primary key auto_increment,
sname varchar(10) not null default '',
gender char(1) not null default '',
company varchar(20) not null default '',
salary decimal(6,2) not null default 0.00,
fanbu smallint not null default 0
)engine myisam charset utf8;


往哪张表 添加行 class

添哪几列 (id,sname,gender,company,salary,fanbu)

分别添加什么值(1,'张三','男','百度',8888.67,234)

insert into class
(id,sname,gender,company,salary,fanbu)
values
(1,'张三','男','百度',8888.67,234);


insert into class
(sname,company,salary)
values
('刘备','皇室成员',15.28),
('孙策','江东集团',56.34),
('曹操','宦官后裔',88.56);

 


=-==update 改的要素
改哪张表 : class
改哪几列 : gender,company
改成什么值: '女','千度'

 

update class
set
gender='女',
company='千度';


====删除要素===
删哪张表的数据: class
删哪几行: where expression

#把salary大于8800的用户删掉
delete from class where salary>8800


====查询3要素===
查哪张表的数据? class
查哪些列? sname,salary,company

 


===这是最基本的增删改查===
针对单个表来说.

后面还要学什么?
如何自己建表?
如何修改表(增加减少列等)
多表联查
子查询
触发器
事务
存储过程
备份恢复

 


燕十八老师太幽默了, 昨天的视频如下:

posted on 2012-10-24 21:24  php小二郎  阅读(179)  评论(0编辑  收藏  举报