0% found this document useful (0 votes)
20 views

Query

The document contains examples of SQL commands like UPDATE, INSERT, SELECT, ALTER, RENAME, DELETE, DROP, ORDER BY, GROUP BY, and CREATE that modify or retrieve data from database tables. The examples update sales data for a store, insert a new employee record, select columns and rows from tables with conditions, alter a table column datatype, rename a table, delete rows, order and group result sets, and create new tables.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

Query

The document contains examples of SQL commands like UPDATE, INSERT, SELECT, ALTER, RENAME, DELETE, DROP, ORDER BY, GROUP BY, and CREATE that modify or retrieve data from database tables. The examples update sales data for a store, insert a new employee record, select columns and rows from tables with conditions, alter a table column datatype, rename a table, delete rows, order and group result sets, and create new tables.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

UPDATE

UPDATE Store_Information
SET Sales = 500
WHERE store_name = "Los Angeles"
AND Date = "Jan-08-1999"

INSERT
INSERT INTO employee (id, name, dept, age, salary location)
VALUES (105, 'Srinath', 'Aeronautics', 27, 33000);

SELECT

SELECT column_name(s)
FROM table_name
SELECT *
FROM sp
WHERE qty BETWEEN 50 and 500

ALTER
ALTER TABLE table_name MODIFY column_name datatype;

ALTER TABLE employee MODIFY salary number(15,2);

RENAME
The SQL RENAME command is used to change the name of the table or a database object.

RENAME old_table_name TO new_table_name;

RENAME employee TO my_emloyee;

DELETE
DELETE FROM table_name [WHERE condition];

DELETE FROM employee WHERE id = 100;

DELETE FROM Persons


WHERE LastName='Tjessem' AND FirstName='Jakob'

DROP
DROP TABLE table_name;
ORDER BY
SELECT name, salary FROM employee ORDER BY salary;

GROUP BY
SELECT dept, SUM (salary)
FROM employee
GROUP BY dept;

CREATE
CREAT TABLE Administrator (adminId varchar(20) not null, surname varchar(20), firstname
varchar(20) not null, departement varchar(20), primary key(adminId));

CREATE TABLE customer


(First_Name char(50),
Last_Name char(50),
Address char(50),
City char(50),
Country char(25),
Birth_Date date)

You might also like