Advertisement
PradoWilder

C 2. Structured Query Language - Insérer des données

May 14th, 2024
15
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. CREATE DATABASE GroceriesDB;
  2. GO
  3.  
  4. USE GroceriesDB;
  5. GO
  6.  
  7. CREATE TABLE Product(ProductID INT IDENTITY(1,1) PRIMARY KEY,
  8. ProductName NVARCHAR(50) NOT NULL,
  9. Price DECIMAL(20,5) NOT NULL
  10. );
  11. GO
  12.  
  13. CREATE TABLE Grocery(GroceryID INT IDENTITY(1,1) PRIMARY KEY,
  14. TotalAmount DECIMAL(10,2) NOT NULL,
  15. GroceryDate DATETIME NOT NULL
  16. );
  17. GO
  18.  
  19. INSERT INTO Product (ProductName, Price)
  20. VALUES
  21. ('Pommes', 2.50),
  22. ('Lait', 3.20),
  23. ('Céréales', 4.95);
  24. GO
  25.  
  26. INSERT INTO Grocery(TotalAmount, GroceryDate)
  27. VALUES
  28. (12.65, '2024-05-14 09:30:45'),
  29. (15.75, '2024-05-13 17:30:27');
  30. GO
  31.  
  32.  
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement