Sitemap
All-in-one StudyPoint

All-in-one StudyPoint

Manual Testing | Test Cases | Bug Reports | Excel | SDLC & STLC | E-commerce Projects | Open to QA Internship & Fresher Jobs 🚀

🌟 SQL-CLAUSES 🌟

2 min readAug 3, 2024

The sql clauses can help filter out the data according to the users’ needs. The main clauses are SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY, INSERT, UPDATE, DELETE, and JOIN.

Press enter or click to view image in full size

➤ SELECT: Specifies the columns to retrieve.

• SELECT column1, column2 FROM table_name;

➤ FROM: Indicates the table to retrieve or manipulate data from.

• SELECT column1, column2 FROM table_name;

➤ WHERE: Adds conditions to filter records.

• SELECT column1, column2 FROM table_name WHERE condition;

➤ GROUP BY: Groups rows with the same values in specified columns.

• SELECT column1, COUNT(*) FROM table_name GROUP BY column1;

➤ HAVING: Filters groups created by GROUP BY.

• SELECT column1, COUNT() FROM table_name GROUP BY column1 HAVING COUNT() > 1;

➤ ORDER BY: Sorts the result set by specified columns.

  • SELECT column1, column2 FROM table_name ORDER BY column1 ASC;

➤JOIN: Combines rows from two or more tables based on a related column.

• SELECT a.column1, b.column2 FROM table1 a INNER JOIN table2 b ON a.common_column = b.common_column;

➤ INSERT INTO: Adds new rows to a table.

• INSERT INTO table_name (column1, column2) VALUES (value1, value2);

➤ UPDATE: Modifies existing rows in a table.

Get All-in-one StudyPoint’s stories in your inbox

Join Medium for free to get updates from this writer.

• UPDATE table_name SET column1 = value1 WHERE condition;

➤ DELETE: Removes rows from a table.

• DELETE FROM table_name WHERE condition;

➤ DISTINCT: Removes duplicate rows from the result set.

• SELECT DISTINCT column1 FROM table_name;

➤ LIMIT: Specifies the maximum number of rows to return.

  • SELECT column1 FROM table_name LIMIT 10;

➤ UNION: Combines the result sets of two or more SELECT statements.

• SELECT column1 FROM table1

• UNIONSELECT column1 FROM table2;

➤ ALTER TABLE: Modifies an existing table structure.

• ALTER TABLE table_name ADD column_name datatype;

➤ CREATE TABLE: Creates a new table.

• CREATE TABLE table_name (

column1 datatype,

column2 datatype,

• );

➤ DROP TABLE: Deletes an existing table and its data.

  • DROP TABLE table_name;

https://www.linkedin.com/groups/13045010

http://www.linkedin.com/in/kunal-gupta-a44a49303

--

--

All-in-one StudyPoint
All-in-one StudyPoint

Written by All-in-one StudyPoint

Manual Testing | Test Cases | Bug Reports | Excel | SDLC & STLC | E-commerce Projects | Open to QA Internship & Fresher Jobs 🚀