· 7 years ago · Oct 04, 2018, 07:58 AM
1drop database if exists ti3_20180914;
2create database if not exists ti3_20180914;
3use ti3_20180914;
4create table pracownicy(
5id integer not null primary key,
6imie varchar(16) not null,
7nazwisko varchar(32) not null
8);
9
10alter table pracownicy add column login varchar(8);
11alter table pracownicy add column haslo varchar(8);
12alter table pracownicy add column pin char(4);
13
14create table wyroby(
15id integer not null primary key,
16nazwa varchar(32) not null
17);
18
19create table magazyny(
20id smallint not null primary key,
21nazwa varchar(16) not null
22);
23
24create table lokalizacjaWyrobow(
25id integer not null primary key,
26wyrobid integer not null,
27magazynid smallint not null,
28ktodaliid integer not null
29);
30
31insert into wyroby values (1, 'podkladka');
32insert into wyroby (id, nazwa) values (2, 'nakretka');
33insert into wyroby (nazwa, ID) values ('nakretka', 3);
34
35delete from wyroby where id = 3;