Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

database.sql 961 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  1. CREATE DATABASE IF NOT EXISTS ShipmentSystem;
  2. USE ShipmentSystem;
  3. CREATE TABLE IF NOT EXISTS Products (
  4. product_id INT AUTO_INCREMENT PRIMARY KEY,
  5. name VARCHAR(255) NOT NULL,
  6. description TEXT,
  7. price DECIMAL(10, 2) NOT NULL,
  8. created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
  9. );
  10. CREATE TABLE IF NOT EXISTS Shipments (
  11. shipment_id INT AUTO_INCREMENT PRIMARY KEY,
  12. product_id INT NOT NULL,
  13. quantity INT NOT NULL,
  14. shipment_date DATE NOT NULL,
  15. status VARCHAR(50) NOT NULL,
  16. created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  17. FOREIGN KEY (product_id) REFERENCES Products(product_id)
  18. );
  19. CREATE TABLE IF NOT EXISTS ShipmentDetails (
  20. detail_id INT AUTO_INCREMENT PRIMARY KEY,
  21. shipment_id INT NOT NULL,
  22. location VARCHAR(255) NOT NULL,
  23. status VARCHAR(50) NOT NULL,
  24. updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  25. FOREIGN KEY (shipment_id) REFERENCES Shipments(shipment_id)
  26. );
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...