postgres=#
postgres=# CREATE TABLE "editions" (
postgres(# "isbn" text NOT NULL,
postgres(# "book_id" integer,
postgres(# "edition" integer,
postgres(# "publisher_id" integer,
postgres(# "publication" date,
postgres(# "type" character(1)
postgres(# );
CREATE TABLE
postgres=#
postgres=# insert into editions values('039480001X', 1608, 1, 59, '1957-03-01', 'h');
INSERT 0 1
postgres=# insert into editions values('0451160916', 7808, 1, 75, '1981-08-01', 'p');
INSERT 0 1
postgres=# insert into editions values('0394800753', 1590, 1, 59, '1949-03-01', 'p');
INSERT 0 1
postgres=# insert into editions values('0590445065', 25908, 1, 150, '1987-03-01', 'p');
INSERT 0 1
postgres=# insert into editions values('0694003611', 1501, 1, 65, '1947-03-04', 'p');
INSERT 0 1
postgres=# insert into editions values('0596000855', 41473, 2, 113, '2001-03-01', 'p');
INSERT 0 1
postgres=#
postgres=# select * from editions;
isbn | book_id | edition | publisher_id | publication | type
------------+---------+---------+--------------+-------------+------
039480001X | 1608 | 1 | 59 | 1957-03-01 | h
0451160916 | 7808 | 1 | 75 | 1981-08-01 | p
0394800753 | 1590 | 1 | 59 | 1949-03-01 | p
0590445065 | 25908 | 1 | 150 | 1987-03-01 | p
0694003611 | 1501 | 1 | 65 | 1947-03-04 | p
0596000855 | 41473 | 2 | 113 | 2001-03-01 | p
(6 rows)
postgres=#
postgres=# --Using ORDER BY
postgres=#
postgres=# SELECT isbn, edition, publication
postgres-# FROM editions
postgres-# ORDER BY publication ASC;
isbn | edition | publication
------------+---------+-------------
0694003611 | 1 | 1947-03-04
0394800753 | 1 | 1949-03-01
039480001X | 1 | 1957-03-01
0451160916 | 1 | 1981-08-01
0590445065 | 1 | 1987-03-01
0596000855 | 2 | 2001-03-01
(6 rows)
postgres=#
postgres=#
postgres=#
postgres=# drop table editions;
DROP TABLE
postgres=#
postgres=#
postgres=#
|