使用TSQL操作面试SQL Server开发人员,使用TSQL操作面试SQL Server开发人员
【 tulaoshi.com - SQLServer 】
在上一篇文章中,我列出了在面试SQL Server数据库开发者时会提问的一些问题,如果我对应聘者的口头回答部分感到满意,我会让他们参加TSQL编程能力的测试,没有比动手操作数据库更有效的方法了,我认为TSQL测试是考察应聘人员的好办法。
一些免责声明
(本文来源于图老师网站,更多请访问http://www.tulaoshi.com/sqlserver/)即使不是全部的话,这些TSQL问题中的大部分都可以使用不同的方法解决,我所提供的答案是我书写查询的方法,也是我所希望见到的答案,但是,既然答案不是唯一的,那么一位精通SQL编程的阅卷人是至关重要的,这样不同的答案才能被合理地考察和评分。
在这个测试中,没有关于指针、存储过程或触发器的问题,因为我所考察的是申请者实现复杂查询和数据修改语句的能力,如果应聘者能够在测试中表现良好,那么我相信他们在编写存储过程和触发器方面是不会遇到很多麻烦的。
预备考试脚本
在开始考试之前,我需要一个模式和一些数据来运行所要考核的查询,列表A创建了所需的这些数据:
列表A:
(本文来源于图老师网站,更多请访问http://www.tulaoshi.com/sqlserver/)IF OBJECT_ID('Sales') 0
DROP TABLE Sales
GO
IF OBJECT_ID('Customers') 0
DROP TABLE Customers
GO
IF OBJECT_ID('Products') 0
DROP TABLE Products
GO
CREATE TABLE Customers
(
CustomerID INT IDENTITY PRIMARY KEY,
FirstName VARCHAR(50),
LastName VARCHAR(50),
City VARCHAR(50),
State CHAR(2),
Zip VARCHAR(10)
)
GO
CREATE TABLE Products
(ProductID TINYINT IDENTITY PRIMARY KEY,ProductName VARCHAR(20),RecommendedPrice MONEY,Category VARCHAR(10)
)GO CREATE TABLE Sales(SaleID INT IDENTITY PRIMARY KEY,ProductID TINYINT NOT NULL REFERENCES Products(ProductID),CustomerID INT NOT NULL REFERENCES Customers(CustomerID),SalePrice MONEY NOT NULL,SaleDate SMALLDATETIME NOT NULL)GO
INSERT INTO Products(ProductName, RecommendedPrice, Category)VALUES('DVD',105,'LivingRoom')INSERT INTO Products(ProductName, RecommendedPrice, Category) VALUES('Microwave',98,'Kitchen')INSERT INTO Products(ProductName, RecommendedPrice, Category)VALUES('Monitor',200,'Office')INSERT INTO Products(ProductName, RecommendedPrice, Category)VALUES('Speakers',85,'Office')INSERT INTO Products(ProductName, RecommendedPrice, Category) VALUES('Refrigerator',900,'Kitchen')INSERT INTO Products(ProductName, RecommendedPrice, Category)VALUES('VCR',165,'LivingRoom')
INSERT INTO Products(ProductName, RecommendedPrice, Category) VALUES('CoffeePot',35,'Kitchen')GO
INSERT INTO Customers(FirstName, LastName, City, State, Zip) VALUES('John','Miller','Asbury','NY','23433') INSERT INTO Customers(FirstName, LastName, City, State, Zip) VALUES('Fred','Hammill','Basham','AK','85675')
INSERT INTO Customers(FirstName, LastName, City, State, Zip) VALUES('Stan','Mellish','Callahan','WY','38556')
INSERT INTO Customers(FirstName, LastName, City, State, Zip) VALUES('Adrian','Caparzo','Denver','CO','12377')
INSERT INTO Customers(FirstName, LastName, City, State, Zip) VALUES('Mike','Horvath','Easton','IN','47130')
INSERT INTO Customers(FirstName, LastName, City, State, Zip) VALUES('Irwin','Wade','Frankfurt','KY','45902')
INSERT INTO Customers(FirstName, LastName, City, State, Zip) VALUES('George','Marshall','Gallipoli','ND','34908')
INSERT INTO Customers(FirstName, LastName, City, State, Zip) VALUES('Frank','Costello','Honolulu','HI','23905')
INSERT INTO Customers(FirstName, LastName, City, State, Zip) VALUES('Billy','Costigan','Immice','SC','75389')
INSERT INTO Customers(FirstName, LastName, City, State, Zip) VALUES('Shelly','Sipes','Lights','AZ','35263')
INSERT INTO Customers(FirstName, LastName, City, State, Zip) VALUES('Chirsty','Melton','Spade','CA','97505')
INSERT INTO Customers(FirstName, LastName, City, State, Zip) VALUES('Amanda','Owens','Flask','CN','50386')
INSERT INTO Customers(FirstName, LastName, City, State, Zip) VALUES('Brittany','Smits','Bourbon','KY','24
来源:http://www.tulaoshi.com/n/20160129/1497119.html
看过《使用TSQL操作面试SQL Server开发人员》的人还看了以下文章 更多>>