You are on page 1of 2

select Name,ID from city LIMIT 3;

SELECT MAX(Population) as População, Name from city;


select SUM(Population) from country;
Select * from city order by Name;
select Continent, Population from country where Continent='Africa' and
Population>12800000;
Select * from country ORDER BY Name;
Select Code from country where Name='Thailand';
Select COUNT(Name) as NumeroTotalDePaíses from country;
select COUNT(Name) from city where Name like '%Ban%';
DELETE FROM city WHERE Name='Porto';
Select * from city Where Name='Porto';
Delete from city where ID=2915;
select * from city where ID=2915;
select * from city where Name='Porto';
insert into city (ID, Name, CountryCode, District, Population) values ('2915',
'Porto', 'PRT', 'Whatever', '2222');
select * from city where Name='Porto';

UPDATE city SET Population=4444 WHERE ID=2915;


select * from city where Name='Porto';
select * from actor and film;--
select * from actor, film;
select * from payment, rental where payment.customer_id=rental.customer_id;
select payment.*, rental.customer_id from payment, rental where
payment.customer_id=rental.customer_id;
create database myschool;
use myschool;

create table aluno(


alunoID int primary key, turma_turmaID int, numero int, nome varchar(222), email
varchar (222)
);
create table disciplina(
disciplinaID int, curso_cursoID int, nome varchar(222), ano int
);
create table nota(
notaID int, valor int, observaçoes varchar(222), média float
);
modify aluno drop turma_turmaID;--
ALTER TABLE disciplina DROP COLUMN curso_cursoID;
drop table aluno;
create table aluno(
alunoID int primary key, turma_turmaID int, numero int, nome varchar(222), email
varchar (222)
);
drop table turma;
create table turma(
turmaID int primary key, nome varchar(222)
);
drop table curso;create table curso(
cursoID int primary key, area varchar(222)
);
drop table disciplina;
create table disciplina(
disciplinaID int primary key, nome varchar(222), ano int
);
drop table nota;
create table nota(
notaID int primary key, valor int, observaçoes varchar(222), média float
);
drop table disciplina;
create table disciplina(
disciplinaID int primary key, nome varchar(222), ano int
);
CREATE TABLE Orders
(
O_Id int NOT NULL,
OrderNo int NOT NULL,
P_Id int,
PRIMARY KEY (O_Id),
FOREIGN KEY (P_Id) REFERENCES Persons(P_Id)
);

alter table aluno add column foreign key();--


drop table aluno;
create table aluno(
alunoID int primary key, numero int, nome varchar(222), email varchar (222)
);
alter table aluno add column foreign key (turmaID) references turma(turmaID);--

You might also like