Bienvenido a Platzi

Cristhian Javier Delgado Fonseca

Cristhian Javier Delgado Fonseca

student
hace 7 meses

Hola porfavor en los recursos el archivo

schema.sql
con el que se trabaja en la sesion. Gracias.

1 respuestas
    Cristhian Javier Delgado Fonseca

    Cristhian Javier Delgado Fonseca

    student
    hace 7 meses
    create database if not exists learning_db; use learning_db; create table if not exists clients( client_id int not null primary key auto_increment, name varchar(100) not null, email varchar(100) not null unique, phone_number varchar(20) not null unique, created_at timestamp default CURRENT_TIMESTAMP, updated_at timestamp default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP ); create table if NOT EXISTS products( `product_id` int not null primary key auto_increment, name varchar(100) not null, sku varchar(100) not null unique, slug varchar(100) not null unique, description text, price float not null default 0, created_at timestamp default CURRENT_TIMESTAMP, updated_at timestamp default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP ); create table if NOT EXISTS clients( client_id int not null primary key auto_increment, name varchar(100) not null, email varchar(100) not null unique, phone_number varchar(20) not null unique, created_at timestamp default CURRENT_TIMESTAMP, updated_at timestamp default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP ); create table if NOT EXISTS bills( bill_id int not null primary key auto_increment, client_id int not null, created_at timestamp default CURRENT_TIMESTAMP, updated_at timestamp default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, foreign key (client_id) references clients(client_id) ); create table if NOT EXISTS bill_products( bill_id int not null, product_id int not null, date_added timestamp default CURRENT_TIMESTAMP, quantity int not null default 1, price float not null default 0, discount float not null default 0, primary key (bill_id, product_id), foreign key (bill_id) references bills(bill_id), foreign key (product_id) references products(product_id) );
Curso de SQL y MySQL

Curso de SQL y MySQL

Crea y administra bases de datos relacionales con SQL y MySQL. Automatiza tareas con triggers y vistas. Mejora consultas con joins, JSON e índices. Gestiona usuarios, respaldos y optimización.

Curso de SQL y MySQL
Curso de SQL y MySQL

Curso de SQL y MySQL

Crea y administra bases de datos relacionales con SQL y MySQL. Automatiza tareas con triggers y vistas. Mejora consultas con joins, JSON e índices. Gestiona usuarios, respaldos y optimización.