Advertisement
vencinachev

127DB

Dec 3rd, 2020
885
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.75 KB | None | 0 0
  1. SHOW DATABASES;
  2.  
  3. CREATE DATABASE autopark;
  4.  
  5. USE autopark;
  6.  
  7. CREATE TABLE persons (
  8. id INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
  9. firstname VARCHAR(200) NOT NULL,
  10. lastname VARCHAR(200) NOT NULL,
  11. age INT,
  12. city VARCHAR(100)
  13. );
  14.  
  15. INSERT INTO persons
  16. VALUES (1, 'Gosho', 'Borisov', 32, 'Kaspichan');
  17.  
  18. INSERT INTO persons (id, firstname, lastname, age, city)
  19. VALUES (2, 'Stamat', 'Todorov', 22, 'Lesidren');
  20.  
  21. INSERT INTO persons (firstname, lastname, city)
  22. VALUES ('Slavi', 'Trifonov', 'Pleven');
  23.  
  24. INSERT INTO persons (firstname, lastname, city)
  25. VALUES ('Ani', 'Vasileva', 'Pleven');
  26.  
  27.  
  28. SELECT * FROM persons WHERE city = 'Pleven';
  29.  
  30. SELECT * FROM persons;
  31.  
  32. DELETE FROM persons WHERE id = 5;
  33.  
  34. UPDATE persons SET city = 'Pleven' WHERE id = 2;
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement