-
bigserial(integer which autoincrements)
-
bit [n]
-
bit varying [ (n) ]
-
boolean
-
box
-
cidr
-
circle
-
inet
-
interval [ fields ] [ (p) ]
-
json
-
jsonb
-
line
-
lseg
-
macaddr
-
macaddr8
-
money
-
path
-
pg_len
-
point
-
polygon
-
smallserial
-
serial
-
text
-
tsquery
-
tsvector
-
txid_snapshot
-
uid
-
xml
- bit
- tinyint
- bool
- boolean
- smallint
- mediumint
- int
- integer
- bigint
- float
- numeric [ (p,s) ]
- double
- double precision
- decimal
- dec
- datetime
- date
- time
- timestamp
- year
- binary
- varbinary
- varbinary(max)
- year
- CHAR
- varchar
- binary: argument is the column length
- varbinary: same as varchar but stores byte strings
- text(n): holds a string of length n
- numeric [ (p,s) ]
- float
- real
CREATE TABLE nelanisacobollover(column_name + data_type + constraints)
CREATE TABLE fortran32(
first_name VARCHAR(50),
last_name VARCHAR(50),
loves_cobol BOOLEAN,
day_he_discovered_ftn TIMESTAMP,)
CREATE TABLE cobolfb(id int, first_name VARCHAR(50), last_name VARCHAR(50), gender VARCHAR(6), date_of_birth TIMESTAMP);
CREATE TABLE nelanftn56837(
id BIGSERIAL NOT NULL PRIMARY KEY,
first_name VARCHAR(50) NOT NULL,
last_name VARCHAR(50) NOT NULL,
loves_cobol BOOLEAN NOT NULL,
day_he_discovered_ftn TIMESTAMP NOT NULL,
email VARCHAR(50));
DROP TABLE tablename;
DROP TABLE nelanftn56837;
- This is an autoincremented number
INSERT INTO fortran32(first_name, last_name, loves_cobol, day_he_discovered_ftn)
VaLUES("42932", "765262632", `TRUE`, DATE `2016-08-08`);
INSERT INTO fortran32(first_name, last_name, loves_cobol, day_he_discovered_ftn, email)
VaLUES("42932", "765262632", `TRUE`, DATE `2016-08-08`, `chensung56837@gmail.com`);
INSERT INTO fortran32(first_name, last_name, loves_cobol, day_he_discovered_ftn)
VaLUES("Nelan", "Pascalfb", `TRUE`, DATE `2016-08-08`);
SELECT * from mytable
SELECT Fname,City from mytable
ClientId | ClientUsername | ClientName | Address | City | Zip Code | Country |
---|---|---|---|---|---|---|
1 | marjones2 | Maria Jones | 801 W 27th St | Dallas | 78172 | USA |
2 | andrewb1 | Andrew Baker | 922E Howard Lane | PflugervilleTX | 78660 | USA |
3 | mikesmith007 | Michael Smith | Potsdamer Platz Str. 7 | Berlin | 10785 | Germany |
4 | joedwards777 | Joey Edwards | Spandauer Str. 2 | Berlin | 10178 | Germany |
5 | roberto88 | Roberto Lane | 14 E 69th St | New York, NY | 10021 | USA |
6 | marianamarufo | Mariana Marufo | 279 E 15th St | Austin,TX | 78778 | USA |
UPDATE Clients
SET ClientName = 'Mariana Perez', City= 'Brooklyn,NY'
WHERE ClientId = 6;
DELETE FROM Client WHERE ClientName='Mariana Marufo';
SELECT * from fortran32 ORDER BY first_name ASC;
- A Column in the Table which uniquely identifies the a record in our table
SELECT 1 <> 2
SELECT * from fortran32 OFFSET 5 LIMIT 5;
SELECT * from fortran32 OFFSET 5;
\l
CREATE DATABASE nelanisacobol32;
create database nelanisacobol32;
psql -h localhost -p 5432 -u nelanslovecs nelanisacobol32;