0
In the student registration system has this logical scheme:
How can I enter the correct student data ?
SQL
-- Geração de Modelo físico
-- Sql ANSI 2003 - brModelo.
CREATE TABLE Aluno (
idaluno varchar(50) PRIMARY KEY auto_increment,
nomeAluno varchar(50),
matricula varchar(50)
);
CREATE TABLE Endereco (
idendereco varchar(50) PRIMARY KEY,
nomerua varchar(50),
cidade varchar(50),
idaluno varchar(50),
FOREIGN KEY(idaluno) REFERENCES Aluno (idaluno)
);
CREATE TABLE Turma (
idturma varchar(50) PRIMARY KEY,
codturma varchar(50),
nomeprofessor varchar(50),
quantidadealunos int,
idaluno varchar(50),
FOREIGN KEY(idaluno) REFERENCES Aluno (idaluno)
);
PHP code
<?php
$NOME ="";
$MATRICULA ="";
$NOMERUA ="";
$CIDADE ="";
$CODTURMA ="";
$NOMEPROFESSOR ="";
#QUANTIDADE ="";
$query = "INSERT INTO aluno('NOME','MATRICULA') VALUES($NOME,$MATRICULA)";
?>
What’s the mistake ?
– NoobSaibot
The data is not being entered correctly
– alexjosesilva
doubt this how to enter the student’s name and at the same time enter the data in the related tables: Address and Class ???
– alexjosesilva
A question, why the tag Python ? This using PHP and Python ?
– NoobSaibot
The system is in php.
– alexjosesilva
Must do double Insert query ??
– alexjosesilva
should do Query1(insert Tabela1: student) and query2 (Insert table2: address ) and query3(Tabela3:class)
– alexjosesilva
See this tutorial: Table Relationship in Mysql
– NoobSaibot
There is a way to insert data in, more than one table at a time ?
– alexjosesilva
Mysql or Postgresql?
– Don't Panic
the database is Mysql
– alexjosesilva
I can use INNER JOIN on Insert ??
– alexjosesilva