当前位置:Gxlcms > 数据库问题 > 数据库

数据库

时间:2021-07-01 10:21:17 帮助过:32人阅读

 

 

 

select
select * from table;
select id,name from table;

distinct
select distinct name,class from table;

where
select * from table where name=‘朱‘ 文本字段的加引号 数值字段不需要

and&or
select * from table where contry=‘usa‘ and age>15;
select * from table where contry=‘usa‘ or contry=‘cn‘

order by
关键字默认按照升序对记录进行排序。如果需要按照降序对记录进行排序,您可以使用 DESC 关键字。
select * from table order by age;
降序
select * from table order by age desc;
多列
select * from table order by name,age;

insert into
insert into table (name,age,contry) values (‘朱‘,18,‘cn‘);
insert into table values (‘朱‘,18,‘cn‘);

UPDATE 语句用于更新表中已存在的记录。 请注意 SQL UPDATE 语句中的 WHERE 子句!
WHERE 子句规定哪条记录或者哪些记录需要更新。如果您省略了 WHERE 子句,所有的记录都将被更新!
update table set name=‘李‘,age=20 where name=‘朱‘

delete

DELETE FROM Websites
WHERE name=‘百度‘ AND country=‘CN‘;
删除所有数据
您可以在不删除表的情况下,删除表中所有的行。这意味着表结构、属性、索引将保持不变:

DELETE FROM table_name;

DELETE * FROM table_name;

数据库

标签:需要   存在   padding   ebs   更新   let   value   where   name   

人气教程排行