Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 571ef01

Browse filesBrowse files
committed
newDB--atmDB
1 parent f26c7f0 commit 571ef01
Copy full SHA for 571ef01

File tree

Expand file treeCollapse file tree

3 files changed

+45
-0
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+45
-0
lines changed

‎atmDB/atmDB--DDL.sql

Copy file name to clipboard
+20Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
CREATE DATABASE IF NOT EXISTS atmDB;
2+
USE atmDB;
3+
4+
/*
5+
describe account;
6+
drop database atmDB;
7+
*/
8+
9+
CREATE TABLE IF NOT EXISTS customer (
10+
id int not null PRIMARY KEY,
11+
name varchar(100) not null
12+
);
13+
14+
CREATE TABLE IF NOT EXISTS account (
15+
id int not null PRIMARY KEY,
16+
balance double not null,
17+
pass varchar(8) not null,
18+
customer_id_fk int not null,
19+
foreign key (customer_id_fk) references customer(id)
20+
)

‎atmDB/atmDB--DML.sql

Copy file name to clipboard
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
USE atmDB;
2+
3+
INSERT INTO customer (id, name) VALUES
4+
(1, "João"),
5+
(2, "Maria"),
6+
(3, "José");
7+
8+
INSERT INTO account (id, balance, pass, customer_id_fk) VALUES
9+
(556, 0, "1234", 1),
10+
(762, 100, "qwerty", 2),
11+
(338, 50, "1q2w3e", 3),
12+
(1001, 1, "0000", 3);
13+
14+
delete from customer where id = 3;

‎atmDB/atmDB--DQL.sql

Copy file name to clipboard
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
USE atmDB;
2+
3+
select * from customer;
4+
select * from account;
5+
6+
select a.account_number, a.pass,
7+
a.balance,
8+
c.name
9+
from account a
10+
join customer c
11+
on c.id = a.customer_id_fk;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.