Create database in mysql linux
Reminder. Riding a database with two tables of shopping and other products. A reference set of one another and some form of semantic principle. How do you get to meet CIA?
create database actividad1 character set latin1 collate latin1_spanish_ci ;
use actividad1;
/**create tables**/
mysql> create table compra(Idcompra varchar(20) primary key default 'SINid',Nomcompra varchar (30),idpro varchar(20) );
Query OK, 0 rows affected (0.09 sec)
mysql> create table producte (idpro varchar(20) primary key default 'SinID',Nompro varchar(30),idcompra varchar(20),foreign key (idcompra) REFERENCES compra (idcompra) on delete no action on update cascade);
Query OK, 0 rows affected (0.11 sec)
/** insert values **/
mysql> insert into compra values (54,'hhh');
Query OK, 1 row affected (0.04 sec)
mysql> insert into compra values (50,'ddd');
Query OK, 1 row affected (0.04 sec)
Query OK, 1 row affected (0.05 sec)
mysql> insert into producte values(4,'aaa',54);
Query OK, 1 row affected (0.04 sec)

Comments
Post a Comment