Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
n sei o nome (30.10)
--tafera outubro BD, 1D --criando a tabela alunos create table alunos( matricula int primary key, nome varchar(50), classe char(2)); --inserindo valores na tabela alunos insert into alunos values(5599, 'Luna Lovegood', '1D'),(9221, 'Olívio Wood', '1D'),(1408, 'Fred Weasley', '1D'),(8440, 'Ginny Weasley', '1D'), (2922, 'Hermione Granger', '1D'),(3959, 'Lilá Brown', '1D'),(7053, 'Harry Potter', '1D'),(2561, 'Draco Malfoy', '1D'),(7449, 'Pansy Parkinson', '1D'), (7256, 'Ronald Weasley', '1D'); --selecionando tudo da tabela alunos select * from alunos; --alterando dados da tabela alunos, adicionando uma nova coluna alter table alunos add sexo varchar(1); --selecionando tudo da tabela alunos select * from alunos; --atualizando dados da tabela para adicionar os sexos update alunos set sexo = 'F'; update alunos set sexo = 'M' where matricula = 9221; update alunos set sexo = 'M' where matricula = 2561; update alunos set sexo = 'M' where matricula = 1408; update alunos set sexo = 'M' where matricula = 7053; update alunos set sexo = 'M' where matricula = 2561; update alunos set sexo = 'M' where matricula = 7256; --selecionando tudo da tabela alunos select * from alunos; --adicionando mais 4 registros na tabela alunos insert into alunos values(16590,'Antônio de Carvalho','3D','M'),(15987,'Joseane de Oliveira','2D','F'),(25132,'Angelo Siqueira','2D','M'), (16599,'Catarina Peixoto','3D','F') --selecionando tudo da tabela alunos select * from alunos; --deletando o alunos Angelo Siqueira da tabela delete from alunos where matricula = 25132; --selecionando tudo da tabela alunos select * from alunos;
run
|
edit
|
history
|
help
0
sql6
BRYAN
bc160401882
SCHOOL-BUILD
hhhhhhhhhhh
Chris
SQL HW 1 Appline
Solution 3
Loan37
do several updates at once