How to create a table in the database?

 To create a table, you need to apply the SQL statement CREATE TABLE with following syntax.

Syntax

CREATE TABLE (columnname datatype(size), columnname datatype(size)…);

Example

USE demodb;

CREATE TABLE Book(BookNumber INT, Title VARCHAR(100), Author VARCHAR(100), Price FLOAT);

CREATE TABLE Student(RollNumber INT, Name VARCHAR(100), Email VARCHAR(50), Mobile CHAR(10), Fees INT);

CREATE TABLE IssueBooks(BookNumber INT, RollNumber INT, IssueDate DATE);

Comments

Popular posts from this blog

What SQL can do?

What are different data types to manage data in the columns or fields?

What is SQL?