ms-sql关联表操作

1、创建数据库employee : create database employee;

2、创建员工表EMP:use employee;create table EMP( id int,sex varchar(6),name varchar(20));

3、创建工资表SAL:user employee;create table SAL( id int,salary float);

4、EMP表插入数据:insert into EMP values(01,'男','李明'),(02,'女','李丽'),(03,'男','赵四');

5、SAL表插入数据:insert into SAL values(01,3500),(02,4200),(03,4500);

6、男员工工资提高10%:update SAL set SAL.salary=SAL.salary*1.1 from EMP,SAL where SAL.id=EMP.id and EMP.sex='男';

原文地址:https://www.cnblogs.com/jefflee168/p/6238321.html