首页 > 开发 > 综合 > 正文

常用SQL语句学习整理

2024-07-21 02:49:55
字体:
来源:转载
供稿:网友
常用SQL语句学习整理

insert into table_name (column_name1,column_name2) values (value1,value2)

delete from table_name where column_name=value

update table_name set column_name=value_new_1,column_name=value_new_2 where column_name=value_old

select top 10 * from table1 where column_name=XXX order by column_name desc

内连接

select table1.column1,table1.column2,table2.column1 from table1 inner join table2 on table1.column1=table2.column1

左外连接

select table1.column1,table2.column1,table1.column2 from table1 left join table2 on table1.column1=table2.column1

右外连接

select table1.column1,table1.column2,table2.column1 from table1 right join table1 on table.column1=table2.column1

全连接

select tabe1.column1,table1.column2,table2.column1 from table1 full join table2 on table.column1=table2.column1

包含

select * from table where column_name like 'X%'

select * from table where column_name like '%X'

select * from table where column_name like '%X%'

select * from table where column_name not like '%X%'


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表