Advertisement
Guest User

Untitled

a guest
Aug 21st, 2019
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. 1. select * from restaurants;
  2. 2. select * from restaurants where cuisine= 'Italian';
  3. 3. select id, name from restaurants where cuisine = 'Italian' limit 10;
  4. 4. select count(*) from restaurants where cuisine = 'Thai';
  5. 5. select count(*) from restaurants;
  6. 6. select count(*) from restaurants where cuisine = 'Thai' and address_zipcode = '11372';
  7. 7. select id, name from restaurants where address_zipcode > '10011' and address_zipcode < '10015' order by name limit 5;
  8. 8. insert into restaurants (name, borough, cuisine, address_building_number, address_street, address_zipcode) values ('Byte Cafe', 'Brooklyn', 'coffee', '123', 'Atlantic Avenue', '11231');
  9. 9. insert into restaurants (name, borough, cuisine, address_building_number, address_street, address_zipcode) values ('Byte Cafe', 'Brooklyn', 'coffee', '123', 'Atlantic Avenue', '11231') returning name, id;
  10. 10. insert into restaurants (name, borough, cuisine, address_building_number, address_street, address_zipcode) values ('Byte Cafe', 'Brooklyn', 'coffee', '123', 'Atlantic Avenue', '11231'), ('Byte Cafe', 'Brooklyn', 'coffee', '123', 'Atlantic Avenue', '11231'), ('Byte Cafe', 'Brooklyn', 'coffee', '123', 'Atlantic Avenue', '11231') returning name, id;
  11. 11. update restaurants set name = 'DJ Reynolds Pub and Restaurant' where nyc_restaurant_id = '30191841';
  12. 12. delete from grades where id = '10';
  13. 13. ERROR: update or delete on table "restaurants" violates foreign key constraint "grades_restaurant_id_fkey" on table "grades"
  14. DETAIL: Key (id)=(10) is still referenced from table "grades".
  15. 14. create table inspectors ( id serial PRIMARY KEY,
  16. restaurants-app(# first_name text NOT NUll, last_name text NOT NULL, borough borough_options);
  17. 15. alter table grades add column notes text;
  18. 16. drop table inspectors;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement