NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

CREATE DATABASE aerolinea;

CREATE TABLE piloto
(
licencia VARCHAR(20) NOT NULL,
nombre VARCHAR(100) NOT NULL,
horas_vuelo NUMERIC(10) NOT NULL
);

CREATE TABLE vuelo
(
vuelo NUMERIC(10) NOT NULL,
inicio VARCHAR(50) NOT NULL,
final VARCHAR(50) NOT NULL
);

CREATE TABLE programacion
(
vuelo NUMERIC(10) NOT NULL,
fecha TIMESTAMP WITHOUT TIME
ZONE NOT NULL,
hora_salida VARCHAR(10) NOT NULL,
hora_llegada VARCHAR(10) NOT NULL,
piloto VARCHAR(20) NOT NULL
);

CREATE TABLE destino
(
destino VARCHAR(50) NOT NULL,
descripcion VARCHAR(100) NOT NULL
);

ALTER TABLE piloto
ADD CONSTRAINT pk_piloto PRIMARY KEY (licencia);

ALTER TABLE vuelo
ADD CONSTRAINT pk_vuelo PRIMARY KEY (vuelo);

ALTER TABLE programacion
ADD CONSTRAINT pk_programacion PRIMARY
KEY (vuelo, fecha);

ALTER TABLE destino
ADD CONSTRAINT pk_destino PRIMARY KEY (destino);

----------------------------------
ALTER TABLE programacion
ADD CONSTRAINT fk_programacion_vuelo
FOREIGN KEY (vuelo) REFERENCES vuelo (vuelo);

ALTER TABLE programacion
ADD CONSTRAINT fk_programacion_piloto
FOREIGN KEY (piloto)
REFERENCES piloto (licencia);

ALTER TABLE vuelo
ADD CONSTRAINT fk_vuelo_destino
FOREIGN KEY (inicio) REFERENCES destino (
destino);

ALTER TABLE vuelo
ADD CONSTRAINT fk_vuelo_destino2 FOREIGN KEY
(final) REFERENCES destino (destino);

-------------------------------------------------------------------
--INSERTAR EN LA TABLA PILOTO
INSERT INTO piloto
VALUES ('1111',
'Juan Perez',
2000);

INSERT INTO piloto
VALUES ('2222',
'Carlos Mora',
5000);

INSERT INTO piloto
VALUES ('3333',
'Marta Mena',
8000);

INSERT INTO piloto
VALUES ('4444',
'Pedro Rojas',
4000);

--INSERTAR EN LA TABLA DESTINO
INSERT INTO destino
VALUES ('1D',
'San Jose');

INSERT INTO destino
VALUES ('2D',
'Panamá');

INSERT INTO destino
VALUES ('3D',
'Caracas');

INSERT INTO destino
VALUES ('4D',
'New York');

INSERT INTO destino
VALUES ('5D',
'Londres');

INSERT INTO destino
VALUES ('6D',
'Montereal');

--INSERTAR EN LA TABLA VUELO
INSERT INTO vuelo
VALUES (520,
'1D',
'4D');

INSERT INTO vuelo
VALUES (618,
'2D',
'4D');

INSERT INTO vuelo
VALUES (705,
'1D',
'5D');

INSERT INTO vuelo
VALUES (820,
'3D',
'6D');

--INSERTAR EN LA TABLA PROGRAMACION
INSERT INTO programacion
VALUES (520,
'01/25/1999',
'5:50',
'6:30',
'2222');

INSERT INTO programacion
VALUES (520,
'01/30/1999',
'12:36',
'16:23',
'3333');

INSERT INTO programacion
VALUES (618,
'02/02/1999',
'10:20',
'15:55',
'2222');

INSERT INTO programacion
VALUES (705,
'03/01/1999',
'16:15',
'5:29',
'1111');

INSERT INTO programacion
VALUES (705,
'03/05/1999',
'22:00',
'8:00',
'1111');

------------------------------------------------------------
---Listar todos los números de licencia y nombre
---de los pilotos cuyo nombre es ‘Juan’

SELECT licencia, nombre
FROM piloto
WHERE nombre LIKE 'Juan%';

--Listar los nombres de los pilotos que
--tienen más de 3000 horas de vuelo
SELECT nombre
FROM piloto
WHERE horas_vuelo > 3000;
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.