sql学习7
时间:2010-09-26 来源:为你抒写
use zhongfei
go select * from t_employee select distinct 1 from t_employee CREATE TABLE T_TempEmployee (FIdCardNumber VARCHAR(20),FName VARCHAR(20),FAge INT, PRIMARY KEY (FIdCardNumber)) INSERT INTO T_TempEmployee(FIdCardNumber,FName,FAge) VALUES('1234567890121','Sarani',33); INSERT INTO T_TempEmployee(FIdCardNumber,FName,FAge) VALUES('1234567890122','Tom',26); INSERT INTO T_TempEmployee(FIdCardNumber,FName,FAge) VALUES('1234567890123','Yalaha',38); INSERT INTO T_TempEmployee(FIdCardNumber,FName,FAge) VALUES('1234567890124','Tina',26); INSERT INTO T_TempEmployee(FIdCardNumber,FName,FAge) VALUES('1234567890125','Konkaya',29); INSERT INTO T_TempEmployee(FIdCardNumber,FName,FAge) VALUES('1234567890126','Fo fa' ,46) ; select * from t_tempemployee SELECT FNumber,FName,FAge FROM T_Employee UNION SELECT FIdCardNumber,FName,FAge FROM T_TempEmployee SELECT '正式员工最高年龄',MAX(FAge) FROM T_Employee UNION SELECT '正式员工最低年龄',MIN(FAge) FROM T_Employee UNION SELECT '临时工最高年龄',MAX(FAge) FROM T_TempEmployee UNION SELECT '临时工最低年龄',MIN(FAge) FROM T_TempEmployee select fnumber,fsalary from t_employee union select '工资合计',sum(fsalary) from t_employee SELECT '以下是正式员工的姓名' UNION ALL SELECT FName FROM T_Employee UNION ALL SELECT '以下是临时工的姓名' UNION ALL SELECT FName FROM T_TempEmployee select * from t_debt select * from t_person use zhongfei go /*在此,sql金典,我学了个皮毛,更高深的知识我都还没有学习,特此要学习加油大家*/ 相关阅读 更多 +