Skip to content

Instantly share code, notes, and snippets.

@Thersis94
Created October 18, 2019 04:15
Show Gist options
  • Save Thersis94/cb12ca2b8a7b9daf4f3b1b90a2dfe564 to your computer and use it in GitHub Desktop.
Save Thersis94/cb12ca2b8a7b9daf4f3b1b90a2dfe564 to your computer and use it in GitHub Desktop.
select *
from restaurants as r
select *
from restaurants
where cuisine='Italian'
select id,name
from restaurants as r
where cuisine='Italian'
limit 10
select Count(distinct id)
from restaurants as r
where cuisine='Thai'
select Count(distinct id)
from restaurants as r
select Count(distinct id)
from restaurants as r
where cuisine='Thai'
and address_zipcode = '11372'
select id,name
from restaurants as r
and address_zipcode
in ('10012', '10013', '10014')
insert into restaurants
(name, borough, cuisine, address_building_number, address_street, address_zipcode)
values (
'Byte Cafe',
'Brooklyn',
'coffee',
'123',
'Atlantic Avenue',
'11231'
)
insert into restaurants
(name, borough, cuisine, address_building_number, address_street, address_zipcode)
values (
'test Cafe',
'Brooklyn',
'coffee',
'123',
'Atlantic Avenue',
'11231'
);
select id
from restaurants as r
where name='test Cafe'
insert into restaurants
(name, borough, cuisine, address_building_number, address_street, address_zipcode)
values (
'test1 Cafe',
'Brooklyn',
'coffee',
'123',
'Atlantic Avenue',
'11231'
);
insert into restaurants
(name, borough, cuisine, address_building_number, address_street, address_zipcode)
values (
'test2 Cafe',
'Brooklyn',
'coffee',
'123',
'Atlantic Avenue',
'11231'
);
insert into restaurants
(name, borough, cuisine, address_building_number, address_street, address_zipcode)
values (
'test3 Cafe',
'Brooklyn',
'coffee',
'123',
'Atlantic Avenue',
'11231'
);
select id,name
from restaurants as r
where name
in (
'test1 Cafe',
'test2 Cafe',
'test3 Cafe'
)
delete from grades as g
where ID='10';
select *
from grades as g
where ID='10'
create table inspectors (
id integer PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
first_name text not null,
last_name text not null,
borough text
)
select *
from restaurants as r
select *
from restaurants
where cuisine='Italian'
select id,name
from restaurants as r
where cuisine='Italian'
limit 10
select Count(distinct id)
from restaurants as r
where cuisine='Thai'
select Count(distinct id)
from restaurants as r
select Count(distinct id)
from restaurants as r
where cuisine='Thai'
and address_zipcode = '11372'
select id,name
from restaurants as r
and address_zipcode
in ('10012', '10013', '10014')
insert into restaurants
(name, borough, cuisine, address_building_number, address_street, address_zipcode)
values (
'Byte Cafe',
'Brooklyn',
'coffee',
'123',
'Atlantic Avenue',
'11231'
)
insert into restaurants
(name, borough, cuisine, address_building_number, address_street, address_zipcode)
values (
'test Cafe',
'Brooklyn',
'coffee',
'123',
'Atlantic Avenue',
'11231'
);
select id
from restaurants as r
where name='test Cafe'
insert into restaurants
(name, borough, cuisine, address_building_number, address_street, address_zipcode)
values (
'test1 Cafe',
'Brooklyn',
'coffee',
'123',
'Atlantic Avenue',
'11231'
);
insert into restaurants
(name, borough, cuisine, address_building_number, address_street, address_zipcode)
values (
'test2 Cafe',
'Brooklyn',
'coffee',
'123',
'Atlantic Avenue',
'11231'
);
insert into restaurants
(name, borough, cuisine, address_building_number, address_street, address_zipcode)
values (
'test3 Cafe',
'Brooklyn',
'coffee',
'123',
'Atlantic Avenue',
'11231'
);
select id,name
from restaurants as r
where name
in (
'test1 Cafe',
'test2 Cafe',
'test3 Cafe'
)
delete from grades as g
where ID='10';
select *
from grades as g
where ID='10'
create table inspectors (
id integer PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
first_name text not null,
last_name text not null,
borough text
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment