Add, delete, modify and check in SQL Server

Hits: 0

One, increase

Keyword – Insert to

The NSERT INTO statement is used to insert new records into a table.

The INSERT INTO statement can be written in two forms.

The first form does not need to specify the name of the column to insert the data into, just provide the value to be inserted:

INSERT INTO table_name
VALUES (value1,value2,value3,...)

The second form requires specifying the column name and the value to be inserted:

INSERT INTO table_name (column1,column2,column3,...)
VALUES (value1,value2,value3,...)

Keyword – Create

The CREATE TABLE statement is used to create tables in the database .

CREATE  TABLE table name
(
column name 1 data type,
column name 2 data type,
column name 3 data type,
....
)

2. Delete

Keyword – Delete

The DELETE statement is used to delete records from a table .

DELETE FROM table_name
WHERE some_column=some_value

Keyword – Drop

DROP statement is used to drop indexes, tables and databases

DROP  INDEX table_name.index_name
 DROP  TABLE table name
 DROP  DATABASE database name

3. Change

Keyword – Update

The UPDATE statement is used to update existing records in a table.

UPDATE table_name
SET column1=value1,column2=value2,...
WHERE some_column=some_value

Keyword – Alter

The ALTER TABLE statement is used to add, modify, or delete columns in an existing table.

ALTER  TABLE table name
 ADD column name datatype

4. Check

Keyword – Select 

The SELECT statement is used to find data from a table .

SELECT column name FROM table name
or:
SELECT * FROM table name

Summary: The lowercase letters in the picture are all operations on data (records), while the uppercase letters are operations on the structures (columns, tables, libraries) in the database.

Leave a Reply

Your email address will not be published.