0% found this document useful (0 votes)
17 views2 pages

SQL Basics: Create and Insert Data

SQL (Structured Query Language) is a standard language for managing and manipulating data in relational databases. It includes commands for creating tables, inserting data, updating, and querying data. The document provides syntax examples for creating a table and inserting data into it.

Uploaded by

gajbel2006
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views2 pages

SQL Basics: Create and Insert Data

SQL (Structured Query Language) is a standard language for managing and manipulating data in relational databases. It includes commands for creating tables, inserting data, updating, and querying data. The document provides syntax examples for creating a table and inserting data into it.

Uploaded by

gajbel2006
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

What is SQL?

SQL (Structured Query Language) is a standard language used to store, retrieve, manage, and
manipulate data in a relational database.

It is used to create databases, define tables, insert data, update data, delete data, and perform
queries.

SQL is used in RDBMS systems like MySQL, Oracle, SQL Server, PostgreSQL, etc.

---

Syntax for Creating a Table (CREATE TABLE)

General Syntax:

CREATE TABLE table_name (

column1 datatype constraint,

column2 datatype constraint,

column3 datatype constraint,

...

);

Example:

CREATE TABLE Students (

StudentID INT PRIMARY KEY,

Name VARCHAR(50),

Age INT,

Course VARCHAR(50)

);

Explanation:

CREATE TABLE → Command to create a new table


Students → Name of the table

StudentID INT PRIMARY KEY → Column with integer datatype and primary key

Name VARCHAR(50) → Stores variable-length text up to 50 characters

Age INT → Stores age

Course VARCHAR(50) → Stores course name

---

Syntax for Inserting Data (INSERT INTO)

General Syntax:

INSERT INTO table_name (column1, column2, column3, ...)

VALUES (value1, value2, value3, ...);

Example:

INSERT INTO Students (StudentID, Name, Age, Course)

VALUES (101, 'Amit', 20, 'BCA');

Explanation:

INSERT INTO Students → Inserts data into the Students table

Column names are listed in order

VALUES (...) → Actual data to be inserted

You might also like