-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdb_escola.sql
More file actions
36 lines (27 loc) · 1.12 KB
/
db_escola.sql
File metadata and controls
36 lines (27 loc) · 1.12 KB
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
use db_escola;
-- criando a tabela
create table tb_alunos (
id bigint auto_increment,
nome varchar(30) not null,
sexo char,
turma bigint not null,
idade bigint,
nota decimal (8.2),
primary key(id)
);
-- preenchendo as colunas da tabela
insert into tb_alunos (nome,sexo,turma,idade,nota) values ("Bruna","F",25,20,7.5);
insert into tb_alunos (nome,sexo,turma,idade,nota) values ("Cauê","M",22,18,10.0);
insert into tb_alunos (nome,sexo,turma,idade,nota) values ("Sheldon","M",25,19,9.5);
insert into tb_alunos (nome,sexo,turma,idade,nota) values ("Talita","F",24,26,5.0);
insert into tb_alunos (nome,sexo,turma,idade,nota) values ("Wesley","M",32,27,8.5);
insert into tb_alunos (nome,sexo,turma,idade,nota) values ("Lucas","M",24,22,9.5);
insert into tb_alunos (nome,sexo,turma,idade,nota) values ("Maria","F",25,20,7.5);
insert into tb_alunos (nome,sexo,turma,idade,nota) values ("Tiagp","M",23,19,8.6);
-- visualiza a tabela preenchida
select* from tb_alunos;
select * from tb_alunos where nota > 7;
select * from tb_alunos where nota < 7;
update tb_alunos set nome = "Tiago"
where id = 8;
select*from tb_alunos;