Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
E2
CREATE TABLE Gamintojas ( Gamintojo_kodas CHAR(4) NOT NULL, Pavadinimas VARCHAR(35) NOT NULL, PRIMARY KEY (Gamintojo_kodas) ); CREATE TABLE Sandelis ( Nr SMALLINT NOT NULL, Daiktu_sk SMALLINT CHECK (Daiktu_sk > 0), PRIMARY KEY (Nr) ); CREATE TABLE Uzsakymas ( Nr INTEGER NOT NULL, Pirkejas CHAR(5) NOT NULL, Prekiu_kiekis SMALLINT NOT NULL, Suma DECIMAL(5,2) CHECK(Suma > 10 AND Suma < 3000), Uzsakymo_data DATE, Issiuntimo_data DATE CHECK (Issiuntimo_data >= Uzsakymo_data), PRIMARY KEY (Nr) ); CREATE TABLE Preke ( Kodas CHAR(5) NOT NULL, Pavadinimas VARCHAR(35) NOT NULL, SN CHAR(7), Gamintojas VARCHAR(35), Kaina DECIMAL(4,2) CONSTRAINT Kainos_dydis CHECK (Kaina > 0 AND Kaina < 300), Uzsakymas INTEGER NOT NULL, Sandelis SMALLINT NOT NULL, PRIMARY KEY (Kodas), CONSTRAINT IUzsakyma FOREIGN KEY (Uzsakymas) REFERENCES Uzsakymas ON DELETE CASCADE ON UPDATE RESTRICT ); CREATE TABLE Pirkejas ( Pirkejo_ID CHAR(6) NOT NULL, Vardas VARCHAR(35) NOT NULL, Pavarde VARCHAR(35) NOT NULL, Adresas VARCHAR(35) NOT NULL, Telefono_nr CHAR(9) NOT NULL, PRIMARY KEY(Pirkejo_ID) ); INSERT INTO Gamintojas VALUES ('1234','RAZERIS'); INSERT INTO Gamintojas VALUES ('4356','KOM'); INSERT INTO Gamintojas VALUES ('7534','FIJI'); INSERT INTO Gamintojas VALUES ('2434','BIM BAM BUM');
run
|
edit
|
history
|
help
0
UNIX_TIMESTAMP
SQL primes, sqrt sieve
1097. Game Play Analysis V
test_tags_count
sss
Product Sales Analysis I - III
Return IDs where there are exactly 3 occurrences1
Webiste SQL Analysis
G.Giftcard Interview Analysis Conducted by Miranda Zhao
extract_pairs