SQL Server: Distinct, Clustered và Non-Clustered Index


Khóa học qua video:
Lập trình Python All Lập trình C# All SQL Server All Lập trình C All Java PHP HTML5-CSS3-JavaScript
Đăng ký Hội viên
Tất cả các video dành cho hội viên
use DBLab2;

select distinct mark from StudentTest;

--distinct: loại bỏ bớt những kết quả giống nhau, chỉ giữa lại 1.

select*from Student;


--Tạo Non-Clustered Index:

create index idx_Name on Student(Name);

create index idx_Age_Status on Student(Age,Status);

select*from StudentTest;

alter table StudentTest drop constraint pk_RN_TestID;


--Tạo Clustered Index trên bảng StudentTest: Mỗi bảng chỉ có duy nhất 1 Clustered Index

create clustered index cidx_RN_TestID on StudentTest(RN,TestID);

create clustered index cidx_RN on Student(RN);


--Xóa index:

drop index Student.idx_Age_Status;

drop index Student.idx_Name;

--Xem thông tin chỉ mục:

exec sp_helpindex 'Student';
» Tiếp: View
« Trước: Xem dữ liệu trên nhiều bảng
Khóa học qua video:
Lập trình Python All Lập trình C# All SQL Server All Lập trình C All Java PHP HTML5-CSS3-JavaScript
Đăng ký Hội viên
Tất cả các video dành cho hội viên
Copied !!!