"Tea coffee" coffee sales management system, a new table bill2, to solve a user corresponding to multiple items of the problem, but after the completion of the discovery of a few more redundant items, still continue to improve ....
The code is as follows:
/****** object:table [dbo]. [Member] Script date:12/26/2014 17:54:54 ******/set ansi_nulls ongoset quoted_identifier ongoset ansi_padding ONGOCREATE TABLE [db O]. [Member] ([MemberID] [char] (one) not null,[membername] [char] (TEN) not null,[membersex] [char] (2) not null,[memberphone] [varchar] ( Null,primary KEY CLUSTERED ([MemberID] ASC) with (Pad_index = off, Statistics_norecompute = off, Ignore_dup_key = OFF, allow_row_locks = on, allow_page_locks = on) on [PRIMARY]) on [Primary]goset ansi_padding offgoinsert [dbo]. [Member] ([MemberID], [membername], [Membersex], [Memberphone]) VALUES (n ' 2000010101 ', n ' Lee ', n ' man ', n ' 15670276163 ') INSERT [dbo]. [Member] ([MemberID], [membername], [Membersex], [Memberphone]) VALUES (n ' 2000010202 ', n ' li two ', n ' Women ', n ' 15670276162 ')/****** object:table [dbo]. [Goods] Script date:12/26/2014 17:54:54 ******/set ansi_nulls ongoset quoted_identifier ongoset ansi_padding ONGOCREATE TABLE [db O]. [Goods] ([Goods_num] [Char] (4) Not Null,[goods_Name] [Char] (TEN) Null,[goods_danjia] [char] (TEN) null,[goods_left] [int] null,primary KEY CLUSTERED ([Goods_num] ASC) with (Pad_index = off, Statistics_norecompute = off, Ignore_dup_key = off, Allow_row_locks = on, allow_page_locks = ON) On [PRIMARY]) on [Primary]goset ansi_padding offgoinsert [dbo]. [Goods] ([Goods_num], [Goods_name], [Goods_danjia], [Goods_left]) VALUES (n ' 1 ', N ' Blue Mountains ', n ' + ', ten) INSERT [dbo]. [Goods] ([Goods_num], [Goods_name], [Goods_danjia], [Goods_left]) VALUES (n ' 2 ', n ' cappuccino ', n ' + ', ten) INSERT [dbo]. [Goods] ([Goods_num], [Goods_name], [Goods_danjia], [Goods_left]) VALUES (n ' 3 ', n ' latte ', n ' ', ten)/****** object:table [dbo]. [BILL] Script date:12/26/2014 17:54:54 ******/set ansi_nulls ongoset quoted_identifier ongoset ansi_padding ONGOCREATE TABLE [db O]. [BILL] ([Bill_num] [char] (TEN) not null,[bill_time] [char] (8) not Null,[bill_paymoney] [money] not Null,[memberid] [char] (one) NUL L,primary KEY CLUSTERED ([Bill_num] ASC)With (Pad_index = off, Statistics_norecompute = off, Ignore_dup_key = off, Allow_row_locks = on, Allow_page_locks = On ) on [PRIMARY]) on [Primary]goset ansi_padding offgoinsert [dbo]. [BILL] ([Bill_num], [Bill_time], [Bill_paymoney], [MemberID]) VALUES (n ' 2010010101 ', n ' 20100101 ', 100.0000, n ' 2000010101 ') INSERT [dbo]. [BILL] ([Bill_num], [Bill_time], [Bill_paymoney], [MemberID]) VALUES (n ' 2010010102 ', n ' 20000102 ', 200.0000, n ' 2000010202 ')/****** object:table [dbo]. [Customers] Script date:12/26/2014 17:54:54 ******/set ansi_nulls ongoset quoted_identifier ongoset ansi_padding ONGOCREATE TABLE [db O]. [Customers] ([Customers_num] [char] (TEN) not null,[bill_num] [char] (TEN) not null,primary KEY CLUSTERED ([Customers_num] ASC) with (Pad_ INDEX = off, Statistics_norecompute = off, Ignore_dup_key = off, Allow_row_locks = on, allow_page_locks = on) on [PRIM ARY]) on [Primary]goset ansi_padding offgo/****** object:table [dbo]. [Bill2] Script date:12/26/2014 17:54:54 ******/set ansi_NULLS ongoset quoted_identifier ongoset ansi_padding ongocreate TABLE [dbo]. [Bill2] ([Goods_num] [Char] (4) not null,[bill_num] [char] (TEN) not null,[bill_sum] [int] NULL, CONSTRAINT [Fk_goodsinfor1] PRIMARY KEY CLUSTERED ([Goods_num] asc,[bill_num] ASC) with (Pad_index = off, Statistics_norecompute = off, Ignore_dup_key = Off , Allow_row_locks = on, allow_page_locks = on) on [PRIMARY]) on [Primary]goset ansi_padding offgoinsert [dbo]. [Bill2] ([Goods_num], [Bill_num], [bill_sum]) VALUES (n ' 1 ', n ' 2010010101 ', 1) INSERT [dbo]. [Bill2] ([Goods_num], [Bill_num], [bill_sum]) VALUES (n ' 1 ', n ' 2010010102 ', 3) INSERT [dbo]. [Bill2] ([Goods_num], [Bill_num], [bill_sum]) VALUES (n ' 2 ', n ' 2010010101 ', 2) INSERT [dbo]. [Bill2] ([Goods_num], [Bill_num], [bill_sum]) VALUES (n ' 3 ', n ' 2010010102 ', 4)/****** Object:check [membersex] Script date:12/26/2014 17:54:54 ******/alter tabl E [dbo]. [Member] With check ADD CONSTRAINT [membersex] Check (([membersex]= ' Male ' OR [membersex]= ' female ')] Goalter TABLE [dbo]. [Member] CHECK CONSTRAINT [membersex]go/****** object:foreignkey [Fk__bill__memberid__060deae8] Script date:12/26/2014 17:54: ******/alter TABLE [dbo]. [BILL] With CHECK ADD FOREIGN KEY ([MemberID]) REFERENCES [dbo]. [Member] ([MemberID]) go/****** Object:foreignkey [FK__BILL2__BILL_NUM__1273C1CD] Script date:12/26/2014 17:54:54 ******/ALTER TABLE [dbo] . [Bill2] With CHECK ADD FOREIGN KEY ([bill_num]) REFERENCES [dbo]. [BILL] ([Bill_num]) go/****** Object:foreignkey [fk__bill2__goods_num__117f9d94] Script date:12/26/2014 17:54:54 ******/ALTER TABLE [dbo ]. [Bill2] With CHECK ADD FOREIGN KEY ([goods_num]) REFERENCES [dbo]. [Goods] ([Goods_num]) go/****** Object:foreignkey [fk__customers__bill___0ad2a005] Script date:12/26/2014 17:54:54 ******/ALTER TABLE [dbo ]. [Customers] With CHECK ADD FOREIGN KEY ([bill_num]) REFERENCES [dbo]. [BILL] ([Bill_num]) GO
As follows:
Database Curriculum Design Renewal