Guest User

Untitled

a guest
Nov 16th, 2019
145
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CREATE DATABASE hotel;
  2. USE hotel;
  3.  
  4. CREATE TABLE employees(
  5. id INT NOT NULL AUTO_INCREMENT,
  6. first_name VARCHAR(50) NOT NULL,
  7. last_name VARCHAR(50) NOT NULL,
  8. title VARCHAR(50) NOT NULL,
  9. notes VARCHAR(50) NOT NULL,
  10. CONSTRAINT pk_employees_id PRIMARY KEY employees(id)
  11. );
  12.  
  13. INSERT INTO employees(first_name,last_name,title,notes)
  14. VALUES ('Ivan','Ivanov','Boss','sample notes'),
  15. ('Kiro','Cekov','Doorman','hardworking'),
  16. ('Marti','Angelov','master shef','cooking notes'),
  17. ('Qsen','Swift','Recepcionist','notes');
  18.  
  19. Select * FROM employees;
  20.  
  21. CREATE TABLE customers(
  22. account_number INT AUTO_INCREMENT PRIMARY KEY NOT NULL,
  23. first_name VARCHAR(50) NOT NULL,
  24. last_name VARCHAR(50) NOT NULL,
  25. phone_nubmer VARCHAR(10) NOT NULL,
  26. emergency_name VARCHAR(50),
  27. emergency_number VARCHAR(10),
  28. notes VARCHAR(50)
  29. );
  30.  
  31. INSERT INTO customers(first_name,last_name,phone_nubmer)
  32. VALUES ('Angel','Angelov','089456734'),
  33. ('Tanq','Angelova','089325671');
  34.  
  35. SELECT * FROM customers;
  36.  
  37. INSERT INTO customers(first_name,last_name,phone_nubmer,emergency_name,emergency_number)
  38. VALUES ('Dani','Danailov','07856432','Danna','0293325');
  39.  
  40. CREATE TABLE room_status(
  41. room_status INT NOT NULL AUTO_INCREMENT PRIMARY KEY UNIQUE,
  42. notes VARCHAR(50)
  43. );
  44.  
  45. INSERT INTO room_status(notes) VALUES('For Clean'),('Occupied'),('Free');
  46. Select * From room_status;
  47.  
  48. CREATE TABLE room_types(
  49. room_type INT NOT NULL AUTO_INCREMENT UNIQUE,
  50. notes VARCHAR(50),
  51. CONSTRAINT pk_room_types PRIMARY KEY room_types(room_type)
  52. );
  53.  
  54. INSERT INTO room_types(notes) VALUES('Apartament'),('Small'),('Medium'),('VIP room');
  55. SELECT * FROM room_types;
  56.  
  57. CREATE TABLE bed_types(
  58. bed_type INT NOT NULL AUTO_INCREMENT PRIMARY KEY UNIQUE,
  59. notes VARCHAR(50)
  60. );
  61.  
  62. INSERT INTO bed_types(notes) VALUES('Double'),('Single'),('Water-filled');
  63. SELECT * FROM bed_types;
  64.  
  65. CREATE TABLE rooms(
  66. room_number INT NOT NULL AUTO_INCREMENT,
  67. room_type INT NOT NULL,
  68. bed_type INT NOT NULL,
  69. rate VARCHAR(50) NOT NULL,
  70. room_status INT NOT NULL,
  71. notes VARCHAR(50),
  72. CONSTRAINT pk_rooms_id PRIMARY KEY rooms(room_number),
  73. CONSTRAINT fk_room_type_id FOREIGN KEY rooms(room_type) REFERENCES room_types(room_type),
  74. CONSTRAINT fk_bed_type_id FOREIGN KEY rooms(bed_type) REFERENCES bed_types(bed_type),
  75. CONSTRAINT fk_room_status_id FOREIGN KEY rooms(room_status) REFERENCES
  76. room_status(room_status)
  77. );
  78.  
  79. INSERT INTO rooms(rate,notes,room_type,bed_type,room_status)
  80. VALUES();-- ????
RAW Paste Data