Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
2
20230403
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Patryk Czarnik
20230403
Commits
2f54ff8d
Commit
2f54ff8d
authored
Apr 06, 2023
by
Patryk Czarnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sklep.sql - wersja finalna
parent
e030369d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
437 additions
and
28 deletions
+437
-28
dump.sql
PC25-SklepWeb/sql/dump.sql
+272
-0
sklep.sql
PC25-SklepWeb/sql/sklep.sql
+94
-28
sklep_wersja_podstawowa.sql
PC25-SklepWeb/sql/sklep_wersja_podstawowa.sql
+71
-0
No files found.
PC25-SklepWeb/sql/dump.sql
0 → 100644
View file @
2f54ff8d
--
-- PostgreSQL database dump
--
-- Dumped from database version 14.7
-- Dumped by pg_dump version 15.2
SET
statement_timeout
=
0
;
SET
lock_timeout
=
0
;
SET
idle_in_transaction_session_timeout
=
0
;
SET
client_encoding
=
'UTF8'
;
SET
standard_conforming_strings
=
on
;
SELECT
pg_catalog
.
set_config
(
'search_path'
,
''
,
false
);
SET
check_function_bodies
=
false
;
SET
xmloption
=
content
;
SET
client_min_messages
=
warning
;
SET
row_security
=
off
;
--
-- Name: public; Type: SCHEMA; Schema: -; Owner: postgres
--
-- *not* creating schema, since initdb creates it
ALTER
SCHEMA
public
OWNER
TO
postgres
;
--
-- Name: order_status; Type: TYPE; Schema: public; Owner: kurs
--
CREATE
TYPE
public
.
order_status
AS
ENUM
(
'NEW'
,
'CONFIRMED'
,
'PAID'
,
'SHIPPED'
,
'DELIVERED'
,
'CLOSED'
,
'RETURNED'
);
ALTER
TYPE
public
.
order_status
OWNER
TO
kurs
;
SET
default_tablespace
=
''
;
SET
default_table_access_method
=
heap
;
--
-- Name: customers; Type: TABLE; Schema: public; Owner: kurs
--
CREATE
TABLE
public
.
customers
(
customer_email
character
varying
(
255
)
NOT
NULL
,
customer_name
character
varying
(
255
)
NOT
NULL
,
phone_number
character
varying
(
20
),
address
character
varying
(
200
),
postal_code
character
(
6
),
city
character
varying
(
100
)
);
ALTER
TABLE
public
.
customers
OWNER
TO
kurs
;
--
-- Name: order_products; Type: TABLE; Schema: public; Owner: kurs
--
CREATE
TABLE
public
.
order_products
(
order_id
integer
NOT
NULL
,
product_id
integer
NOT
NULL
,
quantity
integer
DEFAULT
1
NOT
NULL
,
actual_price
numeric
(
10
,
2
),
actual_vat
numeric
(
2
,
2
),
CONSTRAINT
order_products_quantity_check
CHECK
((
quantity
>
0
))
);
ALTER
TABLE
public
.
order_products
OWNER
TO
kurs
;
--
-- Name: orders_seq; Type: SEQUENCE; Schema: public; Owner: kurs
--
CREATE
SEQUENCE
public
.
orders_seq
START
WITH
10
INCREMENT
BY
1
NO
MINVALUE
NO
MAXVALUE
CACHE
1
;
ALTER
TABLE
public
.
orders_seq
OWNER
TO
kurs
;
--
-- Name: orders; Type: TABLE; Schema: public; Owner: kurs
--
CREATE
TABLE
public
.
orders
(
order_id
integer
DEFAULT
nextval
(
'public.orders_seq'
::
regclass
)
NOT
NULL
,
customer_email
character
varying
(
255
)
NOT
NULL
,
status
public
.
order_status
DEFAULT
'NEW'
::
public
.
order_status
NOT
NULL
,
order_date
timestamp
without
time
zone
DEFAULT
CURRENT_TIMESTAMP
,
delivery_date
date
,
CONSTRAINT
orders_check
CHECK
((
delivery_date
>=
order_date
))
);
ALTER
TABLE
public
.
orders
OWNER
TO
kurs
;
--
-- Name: products_seq; Type: SEQUENCE; Schema: public; Owner: kurs
--
CREATE
SEQUENCE
public
.
products_seq
START
WITH
10
INCREMENT
BY
1
NO
MINVALUE
NO
MAXVALUE
CACHE
1
;
ALTER
TABLE
public
.
products_seq
OWNER
TO
kurs
;
--
-- Name: products; Type: TABLE; Schema: public; Owner: kurs
--
CREATE
TABLE
public
.
products
(
product_id
integer
DEFAULT
nextval
(
'public.products_seq'
::
regclass
)
NOT
NULL
,
product_name
character
varying
(
100
)
NOT
NULL
,
price
numeric
(
10
,
2
)
NOT
NULL
,
vat
numeric
(
2
,
2
),
description
text
,
CONSTRAINT
products_price_check
CHECK
((
price
>
(
0
)::
numeric
)),
CONSTRAINT
products_product_name_check
CHECK
((
length
((
product_name
)::
text
)
>
0
)),
CONSTRAINT
products_vat_check
CHECK
((
vat
>=
(
0
)::
numeric
))
);
ALTER
TABLE
public
.
products
OWNER
TO
kurs
;
--
-- Data for Name: customers; Type: TABLE DATA; Schema: public; Owner: kurs
--
COPY
public
.
customers
(
customer_email
,
customer_name
,
phone_number
,
address
,
postal_code
,
city
)
FROM
stdin
;
ala
@
example
.
com
Ala
Kowalska
123123123
Jasna
14
/
16
01
-
234
Warszawa
ola
@
example
.
com
Ola
Malinowska
321321321
Ciemna
133
99
-
999
Pcim
\
.
--
-- Data for Name: order_products; Type: TABLE DATA; Schema: public; Owner: kurs
--
COPY
public
.
order_products
(
order_id
,
product_id
,
quantity
,
actual_price
,
actual_vat
)
FROM
stdin
;
1
1
1
2900
.
00
0
.
23
1
2
3
2400
.
00
0
.
23
2
2
1
800
.
00
0
.
23
3
4
1
2200
.
00
0
.
23
3
3
1
300
.
00
0
.
23
3
5
1
1000
.
00
0
.
23
\
.
--
-- Data for Name: orders; Type: TABLE DATA; Schema: public; Owner: kurs
--
COPY
public
.
orders
(
order_id
,
customer_email
,
status
,
order_date
,
delivery_date
)
FROM
stdin
;
1
ala
@
example
.
com
PAID
2021
-
11
-
20
12
:
30
:
00
\
N
2
ola
@
example
.
com
SHIPPED
2021
-
11
-
18
10
:
00
:
00
2021
-
12
-
01
3
ala
@
example
.
com
NEW
2023
-
04
-
06
14
:
25
:
01
.
939538
\
N
\
.
--
-- Data for Name: products; Type: TABLE DATA; Schema: public; Owner: kurs
--
COPY
public
.
products
(
product_id
,
product_name
,
price
,
vat
,
description
)
FROM
stdin
;
1
pralka
2900
.
00
0
.
23
Pralka
szybkoobrotowa
2
odkurzacz
800
.
00
0
.
23
Odkurzacz
automatyczny
3
telewizor
55
" 3300.00 0.23 Telewizor 55 cali 4K
4 telewizor 40"
2200
.
00
0
.
23
Telewizor
40
Full
HD
5
myszka
gejmerska
444
.
00
0
.
23
\
N
\
.
--
-- Name: orders_seq; Type: SEQUENCE SET; Schema: public; Owner: kurs
--
SELECT
pg_catalog
.
setval
(
'public.orders_seq'
,
10
,
false
);
--
-- Name: products_seq; Type: SEQUENCE SET; Schema: public; Owner: kurs
--
SELECT
pg_catalog
.
setval
(
'public.products_seq'
,
10
,
false
);
--
-- Name: customers customers_pkey; Type: CONSTRAINT; Schema: public; Owner: kurs
--
ALTER
TABLE
ONLY
public
.
customers
ADD
CONSTRAINT
customers_pkey
PRIMARY
KEY
(
customer_email
);
--
-- Name: order_products order_products_pkey; Type: CONSTRAINT; Schema: public; Owner: kurs
--
ALTER
TABLE
ONLY
public
.
order_products
ADD
CONSTRAINT
order_products_pkey
PRIMARY
KEY
(
order_id
,
product_id
);
--
-- Name: orders orders_pkey; Type: CONSTRAINT; Schema: public; Owner: kurs
--
ALTER
TABLE
ONLY
public
.
orders
ADD
CONSTRAINT
orders_pkey
PRIMARY
KEY
(
order_id
);
--
-- Name: products products_pk; Type: CONSTRAINT; Schema: public; Owner: kurs
--
ALTER
TABLE
ONLY
public
.
products
ADD
CONSTRAINT
products_pk
PRIMARY
KEY
(
product_id
);
--
-- Name: order_products order_products_order_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kurs
--
ALTER
TABLE
ONLY
public
.
order_products
ADD
CONSTRAINT
order_products_order_id_fkey
FOREIGN
KEY
(
order_id
)
REFERENCES
public
.
orders
(
order_id
);
--
-- Name: order_products order_products_product_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kurs
--
ALTER
TABLE
ONLY
public
.
order_products
ADD
CONSTRAINT
order_products_product_id_fkey
FOREIGN
KEY
(
product_id
)
REFERENCES
public
.
products
(
product_id
);
--
-- Name: orders orders_customer_email_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kurs
--
ALTER
TABLE
ONLY
public
.
orders
ADD
CONSTRAINT
orders_customer_email_fkey
FOREIGN
KEY
(
customer_email
)
REFERENCES
public
.
customers
(
customer_email
);
--
-- Name: SCHEMA public; Type: ACL; Schema: -; Owner: postgres
--
REVOKE
USAGE
ON
SCHEMA
public
FROM
PUBLIC
;
GRANT
ALL
ON
SCHEMA
public
TO
PUBLIC
;
--
-- PostgreSQL database dump complete
--
PC25-SklepWeb/sql/sklep.sql
View file @
2f54ff8d
...
@@ -2,70 +2,136 @@ DROP TABLE IF EXISTS order_products;
...
@@ -2,70 +2,136 @@ DROP TABLE IF EXISTS order_products;
DROP
TABLE
IF
EXISTS
orders
;
DROP
TABLE
IF
EXISTS
orders
;
DROP
TABLE
IF
EXISTS
customers
;
DROP
TABLE
IF
EXISTS
customers
;
DROP
TABLE
IF
EXISTS
products
;
DROP
TABLE
IF
EXISTS
products
;
DROP
TYPE
IF
EXISTS
order_status
;
DROP
SEQUENCE
IF
EXISTS
orders_seq
;
DROP
SEQUENCE
IF
EXISTS
products_seq
;
CREATE
SEQUENCE
products_seq
START
10
;
CREATE
SEQUENCE
orders_seq
START
10
;
CREATE
TABLE
products
(
CREATE
TABLE
products
(
product_id
SERIAL
PRIMARY
KEY
,
product_id
INTEGER
DEFAULT
nextval
(
'products_seq'
)
,
product_name
VARCHAR
(
100
)
NOT
NULL
,
product_name
VARCHAR
(
100
)
NOT
NULL
,
price
NUMERIC
(
10
,
2
)
NOT
NULL
,
-- wartości do 99999999.99
price
NUMERIC
(
10
,
2
)
NOT
NULL
,
-- wartości do 99999999.99
vat
NUMERIC
(
2
,
2
),
-- wartości do 0.99
vat
NUMERIC
(
2
,
2
),
-- wartości do 0.99
description
TEXT
description
TEXT
,
-- więzy integralności można też definiować na końcu definicji tabeli:
-- wersja krótka, z automatyczną nazwą:
-- PRIMARY KEY(product_id)
-- werja pełna, z własną nazwą:
CONSTRAINT
products_pk
PRIMARY
KEY
(
product_id
),
CHECK
(
length
(
product_name
)
>
0
),
CHECK
(
price
>
0
),
CHECK
(
vat
>=
0
)
);
);
-- Można też CONSTRAINT zdefiniować poza tabelą:
-- ALTER TABLE products ADD CONSTRAINT products_pk PRIMARY KEY(product_id);
-- w Oraclu nazwy tych typów to: VARCHAR2, NUMBER, CLOB
-- w Oraclu nazwy tych typów to: VARCHAR2, NUMBER, CLOB
CREATE
TABLE
customers
(
CREATE
TABLE
customers
(
-- w tej tabeli nie ma klucza numerycznego, tylko kluczem głównym będzie email klienta
-- w tej tabeli nie ma klucza numerycznego, tylko kluczem głównym będzie email klienta
customer_email
VARCHAR
(
255
)
PRIMARY
KEY
,
customer_email
VARCHAR
(
255
),
customer_name
VARCHAR
(
255
)
NOT
NULL
,
customer_name
VARCHAR
(
255
)
NOT
NULL
,
phone_number
VARCHAR
(
20
),
phone_number
VARCHAR
(
20
),
address
VARCHAR
(
200
),
address
VARCHAR
(
200
),
postal_code
CHAR
(
6
),
postal_code
CHAR
(
6
),
city
VARCHAR
(
100
)
city
VARCHAR
(
100
),
PRIMARY
KEY
(
customer_email
)
);
CREATE
TYPE
order_status
AS
ENUM
(
'NEW'
,
'CONFIRMED'
,
'PAID'
,
'SHIPPED'
,
'DELIVERED'
,
'CLOSED'
,
'RETURNED'
);
);
CREATE
TABLE
orders
(
CREATE
TABLE
orders
(
order_id
SERIAL
PRIMARY
KEY
,
order_id
INTEGER
DEFAULT
nextval
(
'orders_seq'
)
,
customer_email
VARCHAR
(
255
)
NOT
NULL
REFERENCES
customers
(
customer_email
)
,
customer_email
VARCHAR
(
255
)
NOT
NULL
,
status
VARCHAR
(
50
)
DEFAULT
'NEW'
NOT
NULL
,
status
order_status
DEFAULT
'NEW'
NOT
NULL
,
order_date
TIMESTAMP
DEFAULT
current_timestamp
,
order_date
TIMESTAMP
DEFAULT
current_timestamp
,
delivery_date
DATE
delivery_date
DATE
,
PRIMARY
KEY
(
order_id
),
FOREIGN
KEY
(
customer_email
)
REFERENCES
customers
(
customer_email
),
CHECK
(
delivery_date
>=
order_date
)
);
);
-- Realizacja związku wiele do wielu.
-- Realizacja związku wiele do wielu.
-- Akurat w tym przypadku są dodatkowe atrybuty, które trzeba tu wpisać.
-- Akurat w tym przypadku są dodatkowe atrybuty, które trzeba tu wpisać.
CREATE
TABLE
order_products
(
CREATE
TABLE
order_products
(
order_id
INTEGER
NOT
NULL
REFERENCES
orders
(
order_id
)
,
order_id
INTEGER
NOT
NULL
,
product_id
INTEGER
NOT
NULL
REFERENCES
products
(
product_id
)
,
product_id
INTEGER
NOT
NULL
,
quantity
INTEGER
DEFAULT
1
NOT
NULL
,
quantity
INTEGER
DEFAULT
1
NOT
NULL
,
PRIMARY
KEY
(
order_id
,
product_id
)
actual_price
NUMERIC
(
10
,
2
),
actual_vat
NUMERIC
(
2
,
2
),
PRIMARY
KEY
(
order_id
,
product_id
),
FOREIGN
KEY
(
order_id
)
REFERENCES
orders
(
order_id
),
FOREIGN
KEY
(
product_id
)
REFERENCES
products
(
product_id
),
CHECK
(
quantity
>
0
)
);
);
INSERT
INTO
products
(
product_name
,
price
,
vat
,
description
)
INSERT
INTO
products
(
product_id
,
product_name
,
price
,
vat
,
description
)
VALUES
(
'pralka'
,
2500
,
0
.
23
,
'Pralka szybka i oszczędna'
);
VALUES
(
1
,
'pralka'
,
2900
.
00
,
0
.
23
,
'Pralka szybkoobrotowa'
);
INSERT
INTO
products
(
product_id
,
product_name
,
price
,
vat
,
description
)
VALUES
(
2
,
'odkurzacz'
,
800
.
00
,
0
.
23
,
'Odkurzacz automatyczny'
);
INSERT
INTO
products
(
product_id
,
product_name
,
price
,
vat
,
description
)
VALUES
(
3
,
'telewizor 55"'
,
3300
.
00
,
0
.
23
,
'Telewizor 55 cali 4K'
);
INSERT
INTO
products
(
product_id
,
product_name
,
price
,
vat
,
description
)
VALUES
(
4
,
'telewizor 40"'
,
2200
.
00
,
0
.
23
,
'Telewizor 40 Full HD'
);
INSERT
INTO
products
(
product_id
,
product_name
,
price
,
vat
)
VALUES
(
5
,
'myszka gejmerska'
,
444
.
00
,
0
.
23
);
INSERT
INTO
products
(
product_name
,
price
)
VALUES
(
'odkurzacz'
,
500
);
INSERT
INTO
customers
(
customer_email
,
phone_number
,
customer_name
,
address
,
postal_code
,
city
)
VALUES
(
'ala@example.com'
,
'123123123'
,
'Ala Kowalska'
,
'Jasna 14/16'
,
'01-234'
,
'Warszawa'
);
INSERT
INTO
products
INSERT
INTO
customers
(
customer_email
,
phone_number
,
customer_name
,
address
,
postal_code
,
city
)
VALUES
(
DEFAULT
,
'suszarka'
,
1200
,
0
.
23
,
'Szuszy, że hej
'
);
VALUES
(
'ola@example.com'
,
'321321321'
,
'Ola Malinowska'
,
'Ciemna 133'
,
'99-999'
,
'Pcim
'
);
INSERT
INTO
customers
INSERT
INTO
orders
(
order_id
,
customer_email
,
order_date
,
status
)
VALUES
(
'ala@kowalska.pl'
,
'Ala Kowalska'
,
'123123123'
,
'Jasna 14/16a'
,
'01-234'
,
'Warszawa
'
);
VALUES
(
1
,
'ala@example.com'
,
'2021-11-20 12:30:00'
,
'PAID
'
);
INSERT
INTO
orders
(
order_id
,
customer_email
,
order_date
,
status
,
delivery_date
)
VALUES
(
2
,
'ola@example.com'
,
'2021-11-18 10:00:00'
,
'SHIPPED'
,
'2021-12-01'
);
INSERT
INTO
orders
(
customer_email
,
status
,
order_date
,
delivery_date
)
INSERT
INTO
orders
(
order_id
,
customer_email
)
VALUES
(
'ala@kowalska.pl'
,
'DELIVERED'
,
'2022-03-04 13:30:05'
,
'2022-03-08
'
);
VALUES
(
3
,
'ala@example.com
'
);
INSERT
INTO
orders
(
customer_email
)
VALUES
(
'ala@kowalska.pl'
);
INSERT
INTO
order_products
VALUES
(
1
,
1
,
2
);
-- Ala zamówiła dwie pralki
INSERT
INTO
order_products
(
order_id
,
product_id
,
quantity
,
actual_price
,
actual_vat
)
INSERT
INTO
order_products
VALUES
(
1
,
2
,
5
);
-- W tym samym zamówieniu jest 5 odkurzaczy
VALUES
(
1
,
1
,
1
,
2900
.
00
,
0
.
23
);
INSERT
INTO
order_products
VALUES
(
2
,
1
,
1
);
-- W zamówineiu nr 2 jest jedna pralka
INSERT
INTO
order_products
(
order_id
,
product_id
,
quantity
,
actual_price
,
actual_vat
)
VALUES
(
1
,
2
,
3
,
2400
.
00
,
0
.
23
);
INSERT
INTO
order_products
(
order_id
,
product_id
,
quantity
,
actual_price
,
actual_vat
)
VALUES
(
2
,
2
,
1
,
800
.
00
,
0
.
23
);
INSERT
INTO
order_products
(
order_id
,
product_id
,
quantity
,
actual_price
,
actual_vat
)
VALUES
(
3
,
4
,
1
,
2200
.
00
,
0
.
23
);
INSERT
INTO
order_products
(
order_id
,
product_id
,
quantity
,
actual_price
,
actual_vat
)
VALUES
(
3
,
3
,
1
,
300
.
00
,
0
.
23
);
INSERT
INTO
order_products
(
order_id
,
product_id
,
quantity
,
actual_price
,
actual_vat
)
VALUES
(
3
,
5
,
1
,
1000
.
00
,
0
.
23
);
SELECT
*
FROM
products
;
--
SELECT * FROM products;
SELECT
*
FROM
orders
FULL
JOIN
customers
USING
(
customer_email
);
--
SELECT * FROM orders FULL JOIN customers USING(customer_email);
PC25-SklepWeb/sql/sklep_wersja_podstawowa.sql
0 → 100644
View file @
2f54ff8d
DROP
TABLE
IF
EXISTS
order_products
;
DROP
TABLE
IF
EXISTS
orders
;
DROP
TABLE
IF
EXISTS
customers
;
DROP
TABLE
IF
EXISTS
products
;
CREATE
TABLE
products
(
product_id
SERIAL
PRIMARY
KEY
,
product_name
VARCHAR
(
100
)
NOT
NULL
,
price
NUMERIC
(
10
,
2
)
NOT
NULL
,
-- wartości do 99999999.99
vat
NUMERIC
(
2
,
2
),
-- wartości do 0.99
description
TEXT
);
-- w Oraclu nazwy tych typów to: VARCHAR2, NUMBER, CLOB
CREATE
TABLE
customers
(
-- w tej tabeli nie ma klucza numerycznego, tylko kluczem głównym będzie email klienta
customer_email
VARCHAR
(
255
)
PRIMARY
KEY
,
customer_name
VARCHAR
(
255
)
NOT
NULL
,
phone_number
VARCHAR
(
20
),
address
VARCHAR
(
200
),
postal_code
CHAR
(
6
),
city
VARCHAR
(
100
)
);
CREATE
TABLE
orders
(
order_id
SERIAL
PRIMARY
KEY
,
customer_email
VARCHAR
(
255
)
NOT
NULL
REFERENCES
customers
(
customer_email
),
status
VARCHAR
(
50
)
DEFAULT
'NEW'
NOT
NULL
,
order_date
TIMESTAMP
DEFAULT
current_timestamp
,
delivery_date
DATE
);
-- Realizacja związku wiele do wielu.
-- Akurat w tym przypadku są dodatkowe atrybuty, które trzeba tu wpisać.
CREATE
TABLE
order_products
(
order_id
INTEGER
NOT
NULL
REFERENCES
orders
(
order_id
),
product_id
INTEGER
NOT
NULL
REFERENCES
products
(
product_id
),
quantity
INTEGER
DEFAULT
1
NOT
NULL
,
PRIMARY
KEY
(
order_id
,
product_id
)
);
INSERT
INTO
products
(
product_name
,
price
,
vat
,
description
)
VALUES
(
'pralka'
,
2500
,
0
.
23
,
'Pralka szybka i oszczędna'
);
INSERT
INTO
products
(
product_name
,
price
)
VALUES
(
'odkurzacz'
,
500
);
INSERT
INTO
products
VALUES
(
DEFAULT
,
'suszarka'
,
1200
,
0
.
23
,
'Szuszy, że hej'
);
INSERT
INTO
customers
VALUES
(
'ala@kowalska.pl'
,
'Ala Kowalska'
,
'123123123'
,
'Jasna 14/16a'
,
'01-234'
,
'Warszawa'
);
INSERT
INTO
orders
(
customer_email
,
status
,
order_date
,
delivery_date
)
VALUES
(
'ala@kowalska.pl'
,
'DELIVERED'
,
'2022-03-04 13:30:05'
,
'2022-03-08'
);
INSERT
INTO
orders
(
customer_email
)
VALUES
(
'ala@kowalska.pl'
);
INSERT
INTO
order_products
VALUES
(
1
,
1
,
2
);
-- Ala zamówiła dwie pralki
INSERT
INTO
order_products
VALUES
(
1
,
2
,
5
);
-- W tym samym zamówieniu jest 5 odkurzaczy
INSERT
INTO
order_products
VALUES
(
2
,
1
,
1
);
-- W zamówineiu nr 2 jest jedna pralka
SELECT
*
FROM
products
;
SELECT
*
FROM
orders
FULL
JOIN
customers
USING
(
customer_email
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment