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