You are on page 1of 12

Nombre: Matrícula:

Carrera: Ingeniería en Computación Administrativa


Nombre del Curso: Base de datos Nombre del Profesor:

Actividad 5 Comandos

Fecha: 24 de octubre de 2015

Bibliografía
Estos son comenados los resultados de la actividad 6:

mysql> describe universidad;

ERROR 1046 (3D000): No database selected

mysql> use table universidad;

ERROR 1049 (42000): Unknown database 'table'

mysql> use universidad;

Database changed

mysql> create table song;

ERROR 1113 (42000): A table must have at least 1 column

mysql> create table song (Id song int(10) primary key not null unique, nombre va

rchar(50), artista varchar (20), album varchar(50), genero varchar(20), año int(

4), duracion time);

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that

corresponds to your MySQL server version for the right syntax to use near 'song

int(10) primary key not null unique, nombre varchar(50), artista varchar (2' at

line 1

mysql> create table song (Idsong int(10) primary key not null unique, nombre var

char(50), artista varchar (20), album varchar(50), genero varchar(20), año int(4

), duracion time);

Query OK, 0 rows affected (0.30 sec)

mysql> insert into song values (1, "Sumpremacy", "Muse", "The 2nd Law", "Rock",

2014, "00:05:30");

Query OK, 1 row affected (0.35 sec)


mysql> insert into song values (2, "Mr.brightsde", "TheKillers", "Mr.Brightside"

, "Rock", 2008, "00:04:30");

Query OK, 1 row affected (0.08 sec)

mysql> insert into song values (1, "Sumpremacy", "Muse", "The 2nd Law", "Rock",

2014, "00::03:30");

ERROR 1292 (22007): Incorrect time value: '00::03:30' for column 'duracion' at r

ow 1

mysql> insert into song values (1, "Sumpremacy", "Muse", "The 2nd Law", "Rock",

2014, "00:03:30");

ERROR 1062 (23000): Duplicate entry '1' for key 'PRIMARY'

mysql> insert into song values (3, "Come on over", "royal blood", "careless", "R

ock", 2010, "00:03:30");

Query OK, 1 row affected (0.09 sec)

mysql> insert into song values (4, "outside", "infantiles", "foo fighters", "Roc

k", 2012, "00:03:30");

Query OK, 1 row affected (0.08 sec)

mysql> insert into song values (5, "reapers", "drones", "muse", "Rock", 2015, "0

0:04:30");

Query OK, 1 row affected (0.07 sec)

mysql> insert into song values (6, "angel", "theory of a deadman", "savage", "Ro
ck", 2010, "00:02:45");

Query OK, 1 row affected (0.08 sec)

mysql> insert into song values (7, "luz control", "motion city", "luz control",

"Rock", 2007, "00:05:25");

Query OK, 1 row affected (0.08 sec)

mysql> insert into song values (8, "good bye horses", "q lazzarus", "silencio de

los inocentes", "Rock", 1995, "00:06:55");

Query OK, 1 row affected (0.08 sec)

mysql> insert into song values (9, "luciernaga", "miss cafeina", "de polvo y flo

res", "Rock", 2015, "00:06:05");

Query OK, 1 row affected (0.08 sec)

mysql> insert into song values (10, "dream a little dream", "ella fitz gerald",

"best of twenty", "Rock", 1970, "00:04:13");

Query OK, 1 row affected (0.12 sec)

mysql> describe song;

+----------+-------------+------+-----+---------+-------+

| Field | Type | Null | Key | Default | Extra |

+----------+-------------+------+-----+---------+-------+

| Idsong | int(10) | NO | PRI | NULL | |

| nombre | varchar(50) | YES | | NULL | |


| artista | varchar(20) | YES | | NULL | |

| album | varchar(50) | YES | | NULL | |

| genero | varchar(20) | YES | | NULL | |

| año | int(4) | YES | | NULL | |

| duracion | time | YES | | NULL | |

+----------+-------------+------+-----+---------+-------+

7 rows in set (0.01 sec)

mysql> describe table song;

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that

corresponds to your MySQL server version for the right syntax to use near 'table

song' at line 1

mysql> show tables;

+-----------------------+

| Tables_in_universidad |

+-----------------------+

| song |

+-----------------------+

1 row in set (0.00 sec)

mysql> select * from song where genero=rock;

ERROR 1054 (42S22): Unknown column 'rock' in 'where clause'

mysql> select * from song where column genero=rock;

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that

corresponds to your MySQL server version for the right syntax to use near 'colum
n genero=rock' at line 1

mysql> select * from song ;

+--------+----------------------+---------------------+-------------------------

--+--------+------+----------+

| Idsong | nombre | artista | album

| genero | año | duracion |

+--------+----------------------+---------------------+-------------------------

--+--------+------+----------+

| 1 | Sumpremacy | Muse | The 2nd Law

| Rock | 2014 | 00:05:30 |

| 2 | Mr.brightsde | TheKillers | Mr.Brightside

| Rock | 2008 | 00:04:30 |

| 3 | Come on over | royal blood | careless

| Rock | 2010 | 00:03:30 |

| 4 | outside | infantiles | foo fighters

| Rock | 2012 | 00:03:30 |

| 5 | reapers | drones | muse

| Rock | 2015 | 00:04:30 |

| 6 | angel | theory of a deadman | savage

| Rock | 2010 | 00:02:45 |

| 7 | luz control | motion city | luz control

| Rock | 2007 | 00:05:25 |

| 8 | good bye horses | q lazzarus | silencio de los inocente

s | Rock | 1995 | 00:06:55 |

| 9 | luciernaga | miss cafeina | de polvo y flores


| Rock | 2015 | 00:06:05 |

| 10 | dream a little dream | ella fitz gerald | best of twenty

| Rock | 1970 | 00:04:13 |

+--------+----------------------+---------------------+-------------------------

--+--------+------+----------+

10 rows in set (0.00 sec)

mysql> select * from song where Idsong =9;

+--------+------------+--------------+-------------------+--------+------+------

----+

| Idsong | nombre | artista | album | genero | año | durac

ion |

+--------+------------+--------------+-------------------+--------+------+------

----+

| 9 | luciernaga | miss cafeina | de polvo y flores | Rock | 2015 | 00:06

:05 |

+--------+------------+--------------+-------------------+--------+------+------

----+

1 row in set (0.00 sec)

mysql> select nombre, artista from song where Idsong =9;

+------------+--------------+

| nombre | artista |

+------------+--------------+

| luciernaga | miss cafeina |


+------------+--------------+

1 row in set (0.00 sec)

mysql> select nombre, artista from song where duracion >= "00:05:00";

+-----------------+--------------+

| nombre | artista |

+-----------------+--------------+

| Sumpremacy | Muse |

| luz control | motion city |

| good bye horses | q lazzarus |

| luciernaga | miss cafeina |

+-----------------+--------------+

4 rows in set (0.00 sec)

mysql> select nombre, artista from song where nombre like "ang";

Empty set (0.00 sec)

mysql> select nombre, artista from song where nombre like "angel";

+--------+---------------------+

| nombre | artista |

+--------+---------------------+

| angel | theory of a deadman |

+--------+---------------------+

1 row in set (0.00 sec)


mysql> select nombre, artista from song where nombre like "ang*";

Empty set (0.00 sec)

mysql> select nombre, artista from song where nombre like "ANGEL";

+--------+---------------------+

| nombre | artista |

+--------+---------------------+

| angel | theory of a deadman |

+--------+---------------------+

1 row in set (0.00 sec)

mysql> select nombre, artista from song where nombre like "ang%";

+--------+---------------------+

| nombre | artista |

+--------+---------------------+

| angel | theory of a deadman |

+--------+---------------------+

1 row in set (0.00 sec)

mysql> select nombre, artista from song where nombre like "%g%";

+-----------------+---------------------+

| nombre | artista |

+-----------------+---------------------+

| Mr.brightsde | TheKillers |

| angel | theory of a deadman |


| good bye horses | q lazzarus |

| luciernaga | miss cafeina |

+-----------------+---------------------+

4 rows in set (0.00 sec)

mysql> select nombre, artista from song where nombre like "A%g%";

+--------+---------------------+

| nombre | artista |

+--------+---------------------+

| angel | theory of a deadman |

+--------+---------------------+

1 row in set (0.00 sec)

mysql>

mysql> select nombre, duracion from song where nombre="angel" and duracion>="00:

02:00";

+--------+----------+

| nombre | duracion |

+--------+----------+

| angel | 00:02:45 |

+--------+----------+

1 row in set (0.00 sec)

mysql> select nombre, duracion from song where nombre="angel" or duracion>="00:0

2:00";
+----------------------+----------+

| nombre | duracion |

+----------------------+----------+

| Sumpremacy | 00:05:30 |

| Mr.brightsde | 00:04:30 |

| Come on over | 00:03:30 |

| outside | 00:03:30 |

| reapers | 00:04:30 |

| angel | 00:02:45 |

| luz control | 00:05:25 |

| good bye horses | 00:06:55 |

| luciernaga | 00:06:05 |

| dream a little dream | 00:04:13 |

+----------------------+----------+

10 rows in set (0.00 sec)

mysql> select nombre, duracion from song where nombre="angel" or duracion>="00:0

4:30";

+-----------------+----------+

| nombre | duracion |

+-----------------+----------+

| Sumpremacy | 00:05:30 |

| Mr.brightsde | 00:04:30 |

| reapers | 00:04:30 |

| angel | 00:02:45 |
| luz control | 00:05:25 |

| good bye horses | 00:06:55 |

| luciernaga | 00:06:05 |

+-----------------+----------+

7 rows in set (0.00 sec)

mysql>

mysql>

You might also like