Creación de relaciones entre tablas

                         Relaciones entre tablas


En el metodo de creacion de tablas, se colocan las tablas y sus relaciones, como vemos en el siguiente codigo


public void onCreate(SQLiteDatabase db)
{
db.execSQL("create table clientes(cedula int primary key ," +
" nombre text, direccion text, telefono int)");

db.execSQL("create table pedidos(codigo int primary key ," +
" descripcion text, fecha text, cantidad int, cedula foreign key)");

db.execSQL("create table productos(codigo int primary key ," +
" descripcion text, valor float, codigo1 foreign key)");

db.execSQL("create table facturas(numero int primary key ," +
" fecha text, total float)");

}

Comentarios