Estou com um problema ao criar essa tabela com chave estrangeira:
Tabela - box
Colunas - box_id / numero / vago
Tabela - cliente
Colunas - cli_id / nome /cpf
[code] try{
DatabaseMetaData dbm = conn.getMetaData();
// check if “employee” table is there
ResultSet tables = dbm.getTables(null, null, “cliente”, null);
if (tables.next()) {
System.out.print("A tabela já existe ");
} else {
String sql = (“CREATE TABLE cliente(cli_id int NOT NULL PRIMARY KEY, nome varchar(50),cfp int,”
+ “box_Id int FOREIGN KEY REFERENCES box(box_id))”);
PreparedStatement stmt = conn.prepareStatement(sql);
stmt.executeUpdate();
}[/code]
[color=red]ERRO - erro de sintaxe em ou próximo a “FOREIGN”[/color]