Primary and foreign keys and select statements

 create database classss;

use classss;


Create table temp (id int not null,name varchar(50),primary key(id));

create table temp2 (custid int ,name varchar(30),foreign key(custid) references temp(id));

insert into temp (id,name) values

(1,"abhi"),(2,"bhu");

insert into temp2 (custid,name) values (1,"soap"),(2,"brush");

select * from temp;

select * from temp2;

select id from temp;

select distinct name from temp2;



Comments

Popular posts from this blog

DATABASE RELATIONSHIPS

ROUTING (GET /) home route

Query Strings