Class 12 Computer Science notes Chapter 3 Databases Management commands and syntax

Class 12 Computer Science notes Chapter 3 Databases Management commands and syntax

Structured Query Language-(SQL)

SQL is a standard language for storing, manipulating and retrieving data in databases.

In this blog we can learn about the basic commands of DBMS and how to use SQL in: MySQL, SQL Server, MS Access, Oracle, Sybase, Informix, Postgres, and other database systems.

CREATE

CREATE TABLE: Used to create the structure of a table.

CREATE TABLE table_name (column1 datatype, column2 datatype, column3  datatype,….);

ALTER 

ALTER TABLE: Used to implement structure modification.

To add a new column after creating table:

ALTER TABLE table_name ADD column_name datatype;

To modify an existing column.

ALTER TABLE table_name MODIFY COLUMN column_name datatype;


DROP 

DROP TABLE: To remove a table  and remove all of its data

DROP TABLE table_name ;

INSERT

INSERT INTO: is used to insert new records in a table.

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

SELECT

SELECT: The SELECT statement is used to select and display data from a database.

SELECT column1, column2, … FROM table_name;

SELECT * FROM table_name;

SELECT column1, column2, … FROM table_name WHERE condition;

DISTINCT

DISTINCT: Distinct keyword eliminates duplicate rows from the result of a select statement.

SELECT DISTINCT column1, column2, … FROM table_name;


Read More Create a CSV file by entering user-id and password, read and search the password for given you.

ORDER BY

ORDER BY : Used to sort the result-set in ascending or descending order.

SELECT column1, column2, … FROM table_name ORDER BY  column1 … ASC|DESC;

GROUP BY 

GROUP BY : Used with aggregate functions (COUNT, MAX, MIN, SUM, AVG) to group the result-set by one or more columns

SELECT column_name(s) FROM table_name WHERE condition GROUP BY column_name(s)

HAVING

HAVING : Places condition on groups.

SELECT column_name(s) FROM table_name WHERE condition GROUP BY column_name(s) HAVING condition

MAX ()

MAX (): To select the maximum value of a particular column.

SELECT MAX(column_name) FROM table_name WHERE condition;

MIN ()

MIN (): To select the minimum value of a particular column.

SELECT MIN(column_name) FROM table_name WHERE condition;

SUM ()

SUM (): To find the total value of a particular column.

SELECT SUM(column_name) FROM table_name WHERE condition;

AVG ()

AVG (): To find the average value of a particular column.

SELECT AVG(column_name) FROM table_name WHERE condition;

COUNT ()

COUNT (): Returns the number of records in the table.

SELECT COUNT(column_name) FROM table_name WHERE condition;

UPDATE 

UPDATE : Used to modify the existing records in a table.

UPDATE table_name SET column1 = value1, column2 = value2, …WHERE condition;

DELETE

DELETE : Used to delete existing records in a table.

DELETE FROM table_name WHERE condition;

Read More Create a CSV file by entering user-id and password, read and search the password for given you.

Related Search:

  • Databases Management class 12 Notes Computer Science
  • CBSE Revision notes (PDF Download) Free
  • CBSE Revision notes for Class 12 Computer Science PDF
  • CBSE Revision notes Class 12 Computer Science – CBSE
  • CBSE Revisions notes and Key Points Class 12 Computer Science
  • Summary of the NCERT books all chapters in Computer Science class 12
  • Short notes for CBSE class 12th Computer Science
  • Key notes and chapter summary of Computer Science class 12
  • Quick revision notes for CBSE board exams

Post a Comment

If you any doubts, Please let me know

Previous Post Next Post