Unit 1(Laboratory) Flashcards
Creating tables in sqlserver
create table tbl_sample (
s_id int not null identity(1,1) primary key,
s_name varchar(500),
s_amt money,
s_unit int,
s_price decimal(10,4))
Creating tables in mysql
create table tbl_sample (
s_id int not null auto_increment primary key,
s_name varchar(500),
s_amt decimal(10,4),
s_unit int,
s_price decimal(10,4))
the difference between the foreign keys of Sql Server and MySQL
s_id int not null identity(1,1) primary key – SQL Server
s_id int not null auto_increment primary key – MySQL
creating indexes in sql server and mysql
//SQL Server
create unique index emp_testdex on tbl_test(emp_num, test_code, test_date);
//MySQL
create unique index emp_testdex on tbl_test(emp_num(15), test_code(10), test_date);
if you want to put the indexes into asc and desc
//SQL Server and MYSQL
create index prod_pricex on tbl_product(p_price desc);
deleting an index
drop index indexname on tablename
dropping or eliminating an index
//SQL Server and MYSQL
drop index prod_pricex on tbl_product;