Login using Social Account
     Continue with GoogleLogin using your credentials
Primary Key and Unique Key
Primary Key vs Unique Key
Auto Generation of Primary/Unique Keys
SELECT LAST_INSERT_ID();Let's see all above in action.
With AUTO_INCREMENT and Primary key
use retail_db
drop table deptt;
create table deptt (
depid int not null auto_increment,
depname varchar(100) not null,
depcity varchar(100) not null,
depstreet varchar(100) not null,
depopendate date,
primary key ( depid )
);
Without AUTO_INCREMENT and with Primary key
use retail_db
drop table deptt;
create table deptt (
depid int not null,
depname varchar(100) not null,
depcity varchar(100) not null,
depstreet varchar(100) not null,
depopendate date,
primary key ( depid )
);
Without AUTO_INCREMENT and with the Primary key added later
use retail_db
drop table deptt;
create table deptt (
depid int not null,
depname varchar(100) not null,
depcity varchar(100) not null,
depstreet varchar(100) not null,
depopendate date
);
--system named primary key
alter table deptt add primary key (depid);
alter table deptt drop primary key;
--user named primary key
alter table deptt add primary key pk_deptt (depid);
alter table deptt drop primary key;
describe deptt;show create table deptt;
Taking you to the next exercise in seconds...
No hints are availble for this assesment
Answer is not availble for this assesment
Loading comments...