几个常用的sql语句(续)
2008-11-08 11:02
204 查看
1.delete from project where name is null and description is null;
//is null example
2.alter table user add column ip varchar(15) after last_name;
//add column example
3.alter table project add column user_id int after project_id;
4.alter table project add constraint FK_project_ref_user foreign key (user_id)
references user (user_id) on delete restrict on update restrict;
//add foreign key by powerdesigner
5.insert into modify_log_type values(11, 40, 'Meeting', NOW(),NOW(),0);
//using now():current time
6.update modify_log set plan_time=plan_time*60;
// change plan_time(hours) into minutes.
(Here,we will notice that if plan_time is 2.5hours, it will be changed 150minutes. that's right!!!)
7.alter table user modify password varchar(50);
//"modify" key is used to change column type.
("change" key has also the same function , and it can change column name. see sql manual.)
8.update modify_log set finish_time=replace(finish_time, ':', ':');
//replace function
(Here, we can replace Chinese colon with english colon)
好,先总结到这儿!
//is null example
2.alter table user add column ip varchar(15) after last_name;
//add column example
3.alter table project add column user_id int after project_id;
4.alter table project add constraint FK_project_ref_user foreign key (user_id)
references user (user_id) on delete restrict on update restrict;
//add foreign key by powerdesigner
5.insert into modify_log_type values(11, 40, 'Meeting', NOW(),NOW(),0);
//using now():current time
6.update modify_log set plan_time=plan_time*60;
// change plan_time(hours) into minutes.
(Here,we will notice that if plan_time is 2.5hours, it will be changed 150minutes. that's right!!!)
7.alter table user modify password varchar(50);
//"modify" key is used to change column type.
("change" key has also the same function , and it can change column name. see sql manual.)
8.update modify_log set finish_time=replace(finish_time, ':', ':');
//replace function
(Here, we can replace Chinese colon with english colon)
好,先总结到这儿!
相关文章推荐
- SQL语句的几个常用函数
- 几个常用的SQL优化方面的语句
- MySQL最常用的几个基本SQL语句
- 几个常用ORACLE运维监控的SQL语句
- sql语句里几个常用关键字
- 整理出的数据库中几个常用sql查询语句
- 常用的几个SQL 查询语句
- 常用的几个SQL 查询语句
- 常用的SQL语句<二>几个高级查询运算词
- oracle数据库的几个常用的SQL 语句
- 几个常用T_SQL语句比较
- 常用SQL语句整理
- SQLServer中常用的一些操作表,字段和索引的SQL语句
- 数据库SQL SERVER中sql常用语句
- Oracle常用sql语句整理
- mysql建表常用sql语句个人经验分享
- SQLServer中常用的一些操作表,字段和索引的SQL语句
- SQL常用语句速查列表
- mysql学习(7):常用的sql语句
- Oracle维护常用SQL语句