· 6 years ago · Sep 03, 2019, 09:40 AM
1Create TABLE IF NOT EXISTS `Usuaris`(
2
3`ultimId` int not NULL AUTO_INCREMENT PRIMARY KEY,
4`Correu` varchar(256) NOT NULL,
5`Pass` varchar(256) NOT NULL,
6`Nom` varchar(256) NOT NULL,
7`Edat` int NOT NULL,
8`Telefon` int NOT NULL,
9`Sexe` varchar(256) NOT NULL,
10`Tipus` int NOT NULL,
11`Ciutat` varchar (256) NOT NULL
12
13);
14
15Create TABLE IF NOT EXISTS `Perfil`(
16
17`ultimId` int not NULL,
18`idPerfil` int not NULL AUTO_INCREMENT PRIMARY KEY,
19`Domicilio` varchar(256) NOT NULL,
20`QueEstasBuscando` varchar(256) NOT NULL,
21`CuantoMides` int NOT NULL,
22`ConQuienVives` varchar(256) NOT NULL,
23`Fumador` varchar(256) NOT NULL,
24`Estudios` varchar(256) NOT NULL,
25
26Constraint FK_Perfil FOREIGN KEY (ultimId) REFERENCES Usuaris(ultimId)
27
28);
29
30Create TABLE IF NOT EXISTS `SobreMi`(
31
32`ultimId` int not NULL,
33`idSobreMi` int not NULL AUTO_INCREMENT PRIMARY KEY,
34`OrientacionSexual` varchar(256) NOT NULL,
35`SobreMi` varchar(256) NOT NULL,
36`Interesos` varchar(256) NOT NULL,
37`Descripcion` varchar(256) NOT NULL,
38`Personalidad` varchar(256) NOT NULL,
39
40Constraint FK_SobreMi FOREIGN KEY (ultimId) REFERENCES Perfil(ultimId)
41
42);
43
44Create TABLE IF NOT EXISTS `Fotos` (
45`idFoto` int not NULL AUTO_INCREMENT PRIMARY KEY ,
46`Foto` Blob,
47`ultimId` int not NULL,
48
49Constraint FK_Fotos FOREIGN KEY (ultimId) REFERENCES Usuaris(ultimId)
50
51);