---
# System prepended metadata

title: 'session monkchat: banco de dados'

---

# session monkchat: banco de dados

**Nome** Kevin Ribeiro de andrade
**NUMERO** 27
**TURMA** INFOA

## DB DESIGN 
![](https://i.imgur.com/hCrZWvb.png)

## create table

```sql=


CREATE TABLE TB_SALA(

id_sala int primary key auto_increment,
nm_sala varchar(255),
ds_senha int
);

CREATE TABLE TB_USUARIO (
id_usuario int primary key auto_increment,
ds_email varchar(255),
ds_senha int,
nm_nick varchar(255),
dt_inclusao datetime
);

CREATE TABLE TB_CHAT (
id_chat int primary key auto_increment,
id_sala int,
id_usuario int,
nm_mensagem varchar (500),
dt_mensagem datetime,

foreign key id_sala references TB_SALA (id_sala),
FOREIGN KEY id_usuario REFERENCES TB_USUARIO (id_usuario)
);

```