select 一.课上练习代码 1 查询所有学生信息 select * from tb_student; select * from tb_teacher; 2 查询所有课程名称及学分(投影和别名) select couname, coucredit from tb_course; select couname as 课程名称, coucredit 学分 from tb_course; select stuname 姓名, case stusex when 1 then '男' else '女'…
SQL查询: SELECT 普通查询: SELECT "栏位名" FROM "表格名" DISTINCT 查询:(去掉重复) SELECT DISTINCT "栏位名" FROM "表格名" WHERE 条件查询: SELECT "栏位名" FROM "表格名" WHERE "条件" AND 或是 OR 多条件查询: SELECT "栏位名" FR…
Sql Server 函数的操作实例!(返回一条Select语句查询后的临时表) SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE FUNCTION dbo.csjcsj() RETURNS TABLE AS RETURN ( SELECT * from xx ) GO 这是创建代码,执行代码如下: select * from csjcsj() 当然,也可以传参数!…
1 : 多个表联合查询 select j.id, jt.Name, j.ApproveType , j.ProductCode, j.CustomerCode, u.FullName, jf.Name as jfName, j.ExpectedTime from JudgeOrder as j join JudgeOrderType as jt on j.JudgeType=j…