Create Table

Learn to create Table in Kuika.

Parameter Details

tableName The name of the table

columns Contains an 'enumeration' of all the columns that the table have.

To create a new table in the database, the create table statement is used. A table definition consists of a list of columns, their types, and any integrity constraints.

Create Table From Select

You may want to create a duplicate of the table you are using

CREATE TABLE CloneStudents AS SELECT *FROM Students;

To modify the data before passing it to the new table, you can use any of the other features of a SELECT statement. The columns of the new table will be created in reference to the selected rows.

CREATE TABLE ModifiedStudents AS
SELECT Id, CONTACT (FName, " ",Lname) AS
FullName FROM Students WHERE Id>10;

Create a new Table

A basic Students table, containing an ID, and the student’s first and last name along with their student number can be created using:

CREATE TABLE Students (
Id int identity (1,1) primary key not null,
FName varchar(20) not null;
LName varchar(20) not null;
StudentNumber varchar(10) not null
);

This example is specific to Transact-SQL

CREATE TABLE command is used to create a new table in the database, followed by the table name, Students.

This is then followed by the list of column names and their properties, such as the ID

Values and their Meanings

Id: the name of the column

Int: is the type of data.

identity(1,1): the column is going to have auto generated values starting at 1 and increases by one for each new row.

Primary key: means that all values in this column are going to have different values

not null: means that column will not have null values

Last updated