SQL入门学习记录(一)

SQL语句

  • logical operators(逻辑运算符)
符号举例
andwhere age >=30 and age <=40
orwhere City = ‘New York’ or City =‘Chicago’
and…orwhere City=‘New York’ and(Age=30 or Age=35)
inwhere City in (‘New York’ ,‘Los Angeles’)
not inwhere City not in (‘New York’ ,‘Los Angeles’)
  • CONTAT
    把两个或多个表格属性用逗号连接起来,返回在一个列里。
select CONCAT(FirstName,',',City)
from customers

创建一个新的column

select CONCAT(FirstName,',',City) AS new_column
from customers

再次运行时列表名字将变成新定义的col

  • Arithmetic Operators(算数符号)
    加减乘除
IDFirstNameLastNameSalary
1JohnSmith2000
2DavidWilliams1500
select ID,FirstName,LastName,Salary+500 AS Salary
from employees

Result:

IDFirstNameLastNameSalary
1JohnSmith2500
2DavidWilliams2000
  • UPPER(大写)、LOWER(小写)
select FirstName,UPPER(LastName) AS LastName
from employees

Results:

FirstNameLastName
JohnSMITH
DavidWILLIAMS
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值