-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Se agregan tres querys. Para crear la base de datos, para crear la ta…
…bla persona e insertar dos registros y las consultas de la parte 1 y 2
- Loading branch information
1 parent
79868e3
commit 7c70eb7
Showing
3 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--Consulta informacion seleccionada | ||
--SELECT * FROM persona WHERE id_persona IN (1,2,3) | ||
--Ingresamos un nuevo elemento a la tabla | ||
--INSERT INTO persona(nombre,apellido,email) VALUES ('Susana','Lara','slara@mail.com') | ||
--Hacemos la consulta para ver toda la informacion de la tabla | ||
--SELECT * FROM persona | ||
--UPDATE persona SET nombre = 'Ivonne', apellido = 'Esperanza', email = 'iesparza@mail.com' WHERE id_persona = 3 | ||
SELECT * FROM persona | ||
--DELETE FROM persona WHERE id_persona = 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
-- Database: test_bd | ||
|
||
-- DROP DATABASE IF EXISTS test_bd; | ||
|
||
CREATE DATABASE test_bd | ||
WITH | ||
OWNER = postgres | ||
ENCODING = 'UTF8' | ||
LC_COLLATE = 'Spanish_Spain.1252' | ||
LC_CTYPE = 'Spanish_Spain.1252' | ||
TABLESPACE = pg_default | ||
CONNECTION LIMIT = -1 | ||
IS_TEMPLATE = False; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
-- Crea la secuencia | ||
CREATE SEQUENCE IF NOT EXISTS persona_id_persona_seq; | ||
|
||
-- Crea la tabla persona | ||
CREATE TABLE IF NOT EXISTS public.persona | ||
( | ||
id_persona integer NOT NULL DEFAULT nextval('persona_id_persona_seq'), | ||
nombre character varying COLLATE pg_catalog."default", | ||
apellido character varying COLLATE pg_catalog."default", | ||
email character varying COLLATE pg_catalog."default", | ||
CONSTRAINT persona_pkey PRIMARY KEY (id_persona) | ||
) | ||
TABLESPACE pg_default; | ||
|
||
ALTER TABLE IF EXISTS public.persona | ||
OWNER to postgres; | ||
|
||
-- Inserta datos en la tabla persona | ||
INSERT INTO persona(nombre,apellido,email) VALUES ('Susana','Lara','slara@mail.com'); | ||
INSERT INTO persona(nombre,apellido,email) VALUES ('Lorena','Gutierrez','lgutierrez@mail.com'); | ||
|
||
-- Selecciona todas las filas de la tabla persona | ||
SELECT * FROM persona; |