1
SQL Server面试常用sql整理
1281
13页
110次
墨值0
面试常用 SQL 整理
我们都知道面试的时候通常都会考数据库部分的知识,所以在此整理了下我们
常用的面试中常用的一些查询语句 SQL,本人测试数据库为 SQL Server2008
首先在数据库中建立一个测试库,此处用 DavidTest 代替
数据表与相应测试数据
USE [DavidTest]
GO
/****** Object: Table [dbo].[Teacher] Script Date: 02/19/2013
01:09:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Teacher](
[TId] [varchar](10) NULL,
[Tname] [nvarchar](10) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
INSERT [dbo].[Teacher] ([TId], [Tname]) VALUES (N'01', N'张三')
INSERT [dbo].[Teacher] ([TId], [Tname]) VALUES (N'02', N'李四')
INSERT [dbo].[Teacher] ([TId], [Tname]) VALUES (N'03', N'王五')
/****** Object: Table [dbo].[Student] Script Date: 02/19/2013
01:09:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Student](
[SId] [varchar](10) NULL,
[Sname] [nvarchar](10) NULL,
[Sage] [datetime] NULL,
[Ssex] [nvarchar](10) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
INSERT [dbo].[Student] ([SId], [Sname], [Sage], [Ssex]) VALUES
(N'01', N'赵雷', CAST(0x0000806800000000 AS DateTime), N'')
INSERT [dbo].[Student] ([SId], [Sname], [Sage], [Ssex]) VALUES
(N'02', N'钱电', CAST(0x000081CA00000000 AS DateTime), N'')
INSERT [dbo].[Student] ([SId], [Sname], [Sage], [Ssex]) VALUES
(N'03', N'孙风', CAST(0x000080F300000000 AS DateTime), N'')
INSERT [dbo].[Student] ([SId], [Sname], [Sage], [Ssex]) VALUES
(N'04', N'李云', CAST(0x0000814100000000 AS DateTime), N'')
INSERT [dbo].[Student] ([SId], [Sname], [Sage], [Ssex]) VALUES
(N'05', N'周梅', CAST(0x0000832300000000 AS DateTime), N'')
INSERT [dbo].[Student] ([SId], [Sname], [Sage], [Ssex]) VALUES
(N'06', N'吴兰', CAST(0x0000837E00000000 AS DateTime), N'')
INSERT [dbo].[Student] ([SId], [Sname], [Sage], [Ssex]) VALUES
(N'07', N'郑竹', CAST(0x00007FB000000000 AS DateTime), N'')
INSERT [dbo].[Student] ([SId], [Sname], [Sage], [Ssex]) VALUES
(N'08', N'王菊', CAST(0x0000807B00000000 AS DateTime), N'')
/****** Object: Table [dbo].[SC] Script Date: 02/19/2013 01:09:01
******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[SC](
[SId] [varchar](10) NULL,
[CId] [varchar](10) NULL,
[score] [decimal](18, 1) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
INSERT [dbo].[SC] ([SId], [CId], [score]) VALUES (N'01', N'01',
CAST(59.0 AS Decimal(18, 1)))
INSERT [dbo].[SC] ([SId], [CId], [score]) VALUES (N'01', N'02',
CAST(89.0 AS Decimal(18, 1)))
INSERT [dbo].[SC] ([SId], [CId], [score]) VALUES (N'01', N'03',
CAST(99.0 AS Decimal(18, 1)))
INSERT [dbo].[SC] ([SId], [CId], [score]) VALUES (N'02', N'01',
CAST(70.0 AS Decimal(18, 1)))
INSERT [dbo].[SC] ([SId], [CId], [score]) VALUES (N'02', N'02',
CAST(60.0 AS Decimal(18, 1)))
of 13
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文档的来源(墨天轮),文档链接,文档作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论

关注
最新上传
暂无内容,敬请期待...
下载排行榜
Top250 周榜 月榜
近期活动
全部
暂无活动,敬请期待...
相关课程
全部