What are the types of tables in SQL?

135    Asked by dhanan_7781 in SQL Server , Asked on Dec 11, 2023

Can you provide me the some important types of tables in SQL? 

Answered by Unnati gautam

Here are the types of tables in SQL given:-

A Heap Table ( Standard Table) is a regular or day-to-day table where data is stored without any specific order. The SQL command of this is:-

CREATE TABLE Table name( 
       Column1 DataType,
        Column2 DataType,
        …
);

A clustered Table is a table in which data is stored based on sorted. The command of it is

CREATE TABLE TableName ( 
Clustering column DataType,
Other column DataType,

PRIMARY KEY (clusteringcolumn));

A partitioned Table Is a table that is used to improve manageability and performance. The SQL command of it is:-

CREATE TABLE TableName (
      …
) PARTITION BY RANGE (PartitionColumn)(
    PARTITION P1 VALUES LESS THAN (value),
    PARTITION P2 VALUES LESS THAN (value),
    …
);
Temporary Table is used to hold the data in temporary form. Here is the SQL command for it
CREATE TEMPORARY TABLE TableName (

);

Materialized View is a physical table to improve the performance of the query. The command of it is

CREATE MATERIALIZED VIEW ViewName AS
SELECT columns
FROM tables
FROM conditions ;

Global Temporary Table, in which the stored data is accessible to all sessions. The SQL command of it is

“CREATE GLOBAL TEMPORARY TABLE TableName (

);

Level up your career with MSBI training & certification! Start your journey to success today. Enroll now and unleash your full potential!




Your Answer

Interviews

Parent Categories