SHARE
TWEET

Untitled

a guest Jan 20th, 2018 226 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CREATE DATABASE car_rental;
  2. USE car_rental;
  3. CREATE TABLE categories(
  4. id INT PRIMARY KEY AUTO_INCREMENT,
  5. category VARCHAR(30) NOT NULL,
  6. daily_rate DECIMAL,
  7. weekly_rate DECIMAL,
  8. monthly_rate DECIMAL,
  9. weekend_rate DECIMAL
  10. );
  11. CREATE TABLE cars(
  12. id INT PRIMARY KEY AUTO_INCREMENT,
  13. plate_number VARCHAR(30) NOT NULL,
  14. make VARCHAR(30) NOT NULL,
  15. model VARCHAR(30) NOT NULL,
  16. car_year YEAR NOT NULL,
  17. category_id INT NOT NULL,
  18. doors INT NOT NULL,
  19. picture BLOB,
  20. car_condition TEXT,
  21. available VARCHAR(30) NOT NULL
  22. );
  23. CREATE TABLE employees(
  24. id INT PRIMARY KEY AUTO_INCREMENT,
  25. first_name VARCHAR(30) NOT NULL,
  26. last_name VARCHAR(30) NOT NULL,
  27. title VARCHAR(30) NOT NULL,
  28. notes TEXT
  29. );
  30. CREATE TABLE customers(
  31. id INT PRIMARY KEY AUTO_INCREMENT,
  32. driver_licence_number VARCHAR(50) NOT NULL,
  33. full_name VARCHAR(30) NOT NULL,
  34. address VARCHAR(255) NOT NULL,
  35. city VARCHAR(50) NOT NULL,
  36. zip_code INT NOT NULL,
  37. notes TEXT
  38. );
  39. CREATE TABLE rental_orders(
  40. id INT PRIMARY KEY AUTO_INCREMENT,
  41. employee_id INT NOT NULL,
  42. customer_id INT NOT NULL,
  43. car_id INT NOT NULL,
  44. car_condition TEXT,
  45. tank_level DOUBLE NOT NULL,
  46. kilometrage_start INT NOT NULL,
  47. kilometrage_end INT NOT NULL,
  48. total_kilometrage INT NOT NULL,
  49. start_date DATE NOT NULL,
  50. end_date DATE NOT NULL,
  51. total_days INT NOT NULL,
  52. rate_applied VARCHAR(50) NOT NULL,
  53. tax_rate DECIMAL NOT NULL,
  54. order_status VARCHAR(50),
  55. notes TEXT
  56. );
  57. INSERT INTO categories(category, daily_rate, weekly_rate, monthly_rate, weekend_rate)
  58. VALUES('category', 10.5, 10.5, 10.5, 10.5),
  59. ('category', 10.5, 10.5, 10.5, 10.5),
  60. ('category', 10.5, 10.5, 10.5, 10.5);
  61. INSERT INTO cars(plate_number, make, model, car_year, category_id, doors, picture, car_condition, available)
  62. VALUES ('CA 1234 CC', 'make', 'model', '2018', 1, 3, 'picture', 'car_condition', 'Yes'),
  63. ('CA 1234 CC', 'make', 'model', '2018', 1, 3, 'picture', 'car_condition', 'Yes'),
  64. ('CA 1234 CC', 'make', 'model', '2018', 1, 3, 'picture', 'car_condition', 'Yes');
  65. INSERT INTO employees(first_name, last_name, title, notes)
  66. VALUES('first_name', 'last_name', 'title', 'notes'),
  67. ('first_name', 'last_name', 'title', 'notes'),
  68. ('first_name', 'last_name', 'title', 'notes');
  69. INSERT INTO customers(driver_licence_number, full_name, address, city, zip_code, notes)
  70. VALUES ('111111111111111', 'full_name', 'address', 'city', 1528, 'notes'),
  71. ('111111111111111', 'full_name', 'address', 'city', 1528, 'notes'),
  72. ('111111111111111', 'full_name', 'address', 'city', 1528, 'notes');
  73. INSERT INTO rental_orders (employee_id, customer_id, car_id, car_condition, tank_level, kilometrage_start, kilometrage_end, total_kilometrage, start_date, end_date, total_days, rate_applied, tax_rate, order_status, notes)
  74. VALUES (2, 1, 3, 'car_condition', 44.4, 100000, 100500, 100, '2018-01-02', '2018-01-18', 3, 'rate_applied', 20.5, 'order_status', 'notes'),
  75. (2, 1, 3, 'car_condition', 44.4, 100000, 100500, 100, '2018-01-02', '2018-01-18', 3, 'rate_applied', 20.5, 'order_status', 'notes'),
  76. (2, 1, 3, 'car_condition', 44.4, 100000, 100500, 100, '2018-01-02', '2018-01-18', 3, 'rate_applied', 20.5, 'order_status', 'notes');
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top