-
Notifications
You must be signed in to change notification settings - Fork 1
/
practica.sql
45 lines (34 loc) · 961 Bytes
/
practica.sql
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
33
34
35
36
37
38
39
40
41
42
43
44
45
use curso;
CREATE TABLE usuarios(
id int NOT NULL auto_increment,
nombre varchar(80),
apellido varchar(80),
fecha_naciemiento datetime,
primary key (id)
);
alter table usuarios add column telefono varchar(45) null;
alter table usuarios modify column telefono varchar(30) null;
INSERT INTO usuarios(nombre,apellido,fecha_naciemiento, telefono)
values('Cesar','rodriguez',2001-12-20, 3024198990);
select * from usuarios;
select count(*) as 'Cantidad' from usuarios;
delete from usuarios where id = 2;
select nombre, apellido
from usuarios where id = 1;
delete from usuarios where id = 1;
update usuarios
set nombre = 'cesar luis',
apellido = 'rodriguez solera'
where id = 1;
select * from usuarios
where nombre like 'ce%';
CREATE TABLE publicaciones
(
id INT NOT NULL AUTO_INCREMENT,
autor_id INT NOT NULL,
titulo VARCHAR(150) NOT NULL,
texto TEXT NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY (autor_id) REFERENCES usuarios(id)
);
DROP TABLE publicaciones;