MySQL


 create database mike;

        show databases;
        show tables;

        use mike;

        create table user(
            id int not null auto_increment,
            name varchar(50) not null,
            created_by int not null,
            marca varchar(50) not null,
            primary key (id),
            foreign key (created_by) references user (id)
        );

        insert into user (name, edad, correo)
        value
            ('michella', 6, 'michella@gmail.com'),
            ('reyna', 37, 'reyna@hotmail.com'),
            ('mike', 38, 'mikesalinas@me.com');
           
        select * from user;
        select id, edad from user;

        rename table users to user;
        update user set id = 8 where id = 4;
        delete from user where id = 4;  

        select max(edad) as mayor from user;
        select min(edad) as menor from user;

        select * from user order by edad asc;
        select * from user order by edad desc;

        select * from user where id = 1;
        select * from user where correo like '%mi%';
        select * from user where edad between 30 and 40;
        select * from user where edad = 6 or correo = 'michella@me.com';
        select * from user where correo like 'mi%';
        select * from user where edad > 15;

        <span>CSS</span>
            white-space: pre-line;
            line-height: 20px;

No hay comentarios:

Publicar un comentario

Documental de Hackers