-
Notifications
You must be signed in to change notification settings - Fork 0
/
revisão.sql
44 lines (29 loc) · 1.05 KB
/
revisão.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
create database tabela;
use tabela;
create table aluno(
idAluno int primary key auto_increment,
nome varchar(30),
email varchar(30)
);
create table notebook(
codNote int primary key auto_increment,
fab varchar(30),
modelo varchar(30),
fk_aluno int,
foreign key (fk_aluno) references aluno(idAluno)
);
insert into aluno value
(null, 'Emilly', '[email protected]'),
(null, 'Giovanna', '[email protected]');
insert into notebook value
(001, 'Dell', 'vostro', 1),
(002, 'HP', '240', 2);
select * from notebook;
select * from aluno;
select * from aluno, notebook where fk_aluno = idAluno;
select a. *, fab, modelo from aluno as a, notebook as n where fk_aluno = idAluno;
select * from aluno, notebook where fk_aluno = idAluno and fab = 'Dell';
select * from aluno, notebook where fk_aluno = idAluno and modelo = 'vostro';
select * from aluno, notebook where fk_aluno = idAluno and nome = 'Giovanna';
select * from aluno, notebook where fk_aluno = idAluno and email = '[email protected]';
select * from aluno, notebook where fk_aluno = idAluno and codNote = 1