GERAR UM MODELO RELACIONAL NO MODELO E/R;
Artigos Científicos: GERAR UM MODELO RELACIONAL NO MODELO E/R;. Pesquise 862.000+ trabalhos acadêmicosPor: jessicakilla • 17/12/2014 • 513 Palavras (3 Páginas) • 636 Visualizações
GERAR UM MODELO RELACIONAL NO MODELO E/R;
-------------------------------------------------------------------------------
Microsoft Windows [versão 6.2.9200]
(c) 2012 Microsoft Corporation. Todos os direitos reservados.
C:\Users\raul>cd\
C:\>cd xampp
C:\xampp>cd mysql
C:\xampp\mysql>cd bin
C:\xampp\mysql\bin>mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.5.27 MySQL Community Server (GPL)
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database trabalho01;
Query OK, 1 row affected (0.00 sec)
CRIAR NO MINIMO 4 TABELAS SENDO QUE NO MÍNIMO UMA COM CHAVE EXTRANGEIRA;
-------------------------------------------------------------------------------
mysql> use trabalho01;
Database changed
mysql> create table carro ( codcar integer primary key, nome varchar(50));
Query OK, 0 rows affected (0.39 sec)
mysql> create table cor ( nome varchar(50), codcor integer primary key);
Query OK, 0 rows affected (0.09 sec)
mysql> create table rodas ( codroda integer primary key, nome varchar(50), taman
ho varchar(50));
Query OK, 0 rows affected (0.12 sec)
mysql> create table modelo ( nome varchar(50), idmodel integer primary key, codcar integer, foreign key fk_car (codcar) references carro (codcar));
Query OK, 0 rows affected (0.11 sec)
mysql> alter table rodas
-> add valor float(10,3);
Query OK, 0 rows affected (0.27 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> alter table carro
-> add valor float(10,3);
Query OK, 0 rows affected (0.25 sec)
Records: 0 Duplicates: 0 Warnings: 0
SIMULAR O PREENCHIMENTO DO BD COM COMANDOS SQL NO MÍNIMO 5 PARA CADA TABELA;
===============================================================================
mysql> insert into carro (nome,codcar) values ('CAMARO',001);
Query OK, 1 row affected (0.06 sec)
mysql> insert into carro (nome,codcar) values ('GOLF',002);
Query OK, 1 row affected (0.07 sec)
mysql> insert into carro (nome,codcar) values ('GOL',003);
Query OK, 1 row affected (0.45 sec)
mysql> insert into carro (nome,codcar) values ('CROSS FOX',004);
Query OK, 1 row affected (0.05 sec)
mysql> insert into carro (nome,codcar) values ('mais carros',005);
Query OK, 1 row affected (0.07 sec)
mysql>
...