Skip to content

Commit fd5c553

Browse files
rpraveenpaikburtram
authored andcommitted
updated sql2016-crud-demo (#1156)
1 parent cd75466 commit fd5c553

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

samples/sql2016-crud-demo.sql

+10-8
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@ CREATE TABLE [dbo].[Customers]
3131
[CustId] [int] NOT NULL,
3232
[FirstName] [nvarchar](50) NOT NULL,
3333
[LastName] [nvarchar](50) NOT NULL,
34+
[DateOfBirth][date] NOT NULL,
3435
[Email] [nvarchar](50) NOT NULL,
3536

37+
3638
PRIMARY KEY CLUSTERED ([CustId] ASC) ON [PRIMARY]
3739
);
3840
GO
@@ -42,19 +44,19 @@ SELECT * FROM Customers;
4244
GO
4345

4446
-- Insert sample data into table
45-
INSERT INTO [dbo].[Customers]([CustId],[FirstName],[LastName],[Email])
47+
INSERT INTO [dbo].[Customers]([CustId],[FirstName],[LastName],[DateOfBirth],[Email])
4648
VALUES
47-
(1, 'Amitabh', 'Bachchan', '[email protected]'),
48-
(2, 'Abhishek', 'Bachchan', '[email protected]'),
49-
(3, 'Aishwarya', 'Rai', '[email protected]'),
50-
(4, 'Aamir', 'Khan', '[email protected]')
49+
(1, 'Amitabh', 'Bachchan', '1942-07-10','[email protected]'),
50+
(2, 'Abhishek', 'Bachchan','1976-05-06','[email protected]'),
51+
(3, 'Aishwarya', 'Rai','1973-11-06', '[email protected]'),
52+
(4, 'Aamir', 'Khan','1965-04-28', '[email protected]')
5153
GO
5254

5355
-- Dump records (we should have 4 records now)
5456
SELECT * FROM Customers;
5557
GO
5658

57-
-- Update 2 records
59+
-- Update 2 records(Sets email as bachans@gmailcom to all those who have lastname as Bachan)
5860
UPDATE Customers
5961
SET Email = '[email protected]'
6062
WHERE LastName = 'Bachchan'
@@ -64,9 +66,9 @@ GO
6466
SELECT * FROM Customers;
6567
GO
6668

67-
-- Delete a record
69+
-- Delete a record(Customer with DateOfBirth 1965-04-28 i.e, Aamir Khan, will be deleted)
6870
DELETE FROM Customers
69-
WHERE CustId = 4
71+
WHERE DateOfBirth = '1965-04-28'
7072
GO
7173

7274
-- Dump records (note that we only have 3 records now)

0 commit comments

Comments
 (0)