/* First change the editor */
define _editor=nano
/* To see what tables you already have */
select table_name from user_tables;
/* Create a table with two attributes and no primary key */
CREATE TABLE test_table
(a INTEGER, b VARCHAR2(10));
/* Drop table */
DROP TABLE test_table;
/* Drop table */
DROP TABLE test_table;
/* Create table with primary key */
CREATE TABLE people
(id INTEGER,
name VARCHAR2(10),
PRIMARY KEY (id));
/* See description of the table */
desc people;
/* Insert 2 tuples in the table */
INSERT INTO people VALUES (1, 'vladimir');
INSERT INTO people(name, id) VALUES ('evgeny', 2);
/* List all data from the tables */
SELECT * FROM people;
/* List all data from the table */
SELECT * FROM people;
/* Delete some data from the table */
DELETE FROM people
WHERE id=3;
/* Add one more table at the beginning of the file */
CREATE TABLE album(
id CHAR(10) NOT NULL PRIMARY KEY,
title VARCHAR(100),
artist VARCHAR(100)
);
/* Add foregn key in the track table*/
CREATE TABLE track(
ed
album CHAR(10),
ed
disk INTEGER,
posn INTEGER,
song VARCHAR(255),
PRIMARY KEY (album, disk, posn),
FOREIGN KEY (album) REFERENCES album
);