-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcarrosBD
More file actions
32 lines (26 loc) · 760 Bytes
/
carrosBD
File metadata and controls
32 lines (26 loc) · 760 Bytes
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
-- Verificar dados da tabela
select * from carros;
-- Criação da tabela
create table carros (
idCarros bigint not null
generated always as identity (start with 1, increment by 1),
modelo varchar(30) not null,
marca varchar(30) not null,
ano varchar(4) not null,
categoria varchar(30) not null,
primary key (idCarros)
);
-- Colocação de dados na tabela
insert into carros(modelo,marca,ano,categoria)
values('CLA 200','Mercedes','2018','Alto');
insert into carros(modelo,marca,ano,categoria)
values('HB20','Hyundai','2019','Medio padrao');
-- Atualização de dados
update carros
set categoria = 'Alto padrao'
where idCarros = 1;
update carros
set ano = 2018
where idCarros = 2;
-- Deletar dados
delete from carros where idCarros = 2;