高分急求简单的SQL语句
1、用SQL语句建立2个数据库表。
表一:产品编号、产品名称、产品价格;表二:产品编号、供应商。(两个表的“产品编号”为主键,且相关联)
IP:10.174.179.174 数据库:test 用户名:SA 密码:SA
[解决办法]
后边的IP:10.174.179.174 数据库:test 用户名:SA 密码:SA
如何写?请指教
--------------------------------
打开查询分析器,登录服务器,选中数据库,运行代码就行了。
[解决办法]
/****** 对象: Table [dbo].[tab_1] 脚本日期: 08/22/2007 09:50:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[tab_1](
[产品编号] [int] NOT NULL,
[产品名称] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
[产品价格] [float] NULL,
PRIMARY KEY CLUSTERED
(
[产品编号] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
/****** 对象: Table [dbo].[tab_2] 脚本日期: 08/22/2007 09:50:39 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[tab_2](
[产品编号] [int] NOT NULL,
[供应商] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
PRIMARY KEY CLUSTERED
(
[产品编号] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
ALTER TABLE [dbo].[tab_2] WITH CHECK ADD CONSTRAINT [FK_tab_2_tab_1] FOREIGN KEY([产品编号])
REFERENCES [dbo].[tab_1] ([产品编号])
GO
ALTER TABLE [dbo].[tab_2] CHECK CONSTRAINT [FK_tab_2_tab_1]
[解决办法]
既然知道了IP:10.174.179.174 数据库:test 用户名:SA 密码:SA
这些?用查询分析器连过去,或者用OSQL ISQL等工具
用楼上各位的代码创建就可以了啊?