Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

SQL Cheat Sheet by Bandeshah, Study notes of Computer science

The SQL Cheat Sheet by Bandeshah is a document that provides a quick reference guide to the Structured Query Language (SQL). SQL is a programming language used to manage and manipulate relational databases. The cheat sheet includes the basic syntax and commands used in SQL, such as SELECT, FROM, WHERE, ORDER BY, and GROUP BY. It also includes information on functions, data types, and operators used in SQL queries. This cheat sheet is useful for beginners and experienced SQL users who want a quick reference guide to SQL syntax and commands. It can be used as a quick reference guide when working with SQL databases, helping users to write efficient and effective SQL queries.

Typology: Study notes

2022/2023

Uploaded on 05/04/2023

muniza-aftab
muniza-aftab 🇵🇰

1 document

Partial preview of the text

Download SQL Cheat Sheet by Bandeshah and more Study notes Computer science in PDF only on Docsity! SQL QUERIES CHEAT SHEET AS 9618. DML 1. To select certain records in a data base, keywords, Display/Return/Show… SELECT column1, column2, ... FROM table_name WHERE condition; ORDER BY column1, column2, ... ASC|DESC; 2. To insert new record(s) in a Table INSERT INTO table_name (column1, column2, column3, ...) VALUES (value1, value2, value3, ...); 3. Modify existing record(s) in Table UPDATE table_name SET column1 = value1, column2 = value2, ... WHERE condition; 4. Delete Record(s) from the Table DELETE FROM table_name WHERE condition; 5. Returns the number of rows which matches the criteria SELECT COUNT(column_name) FROM table_name WHERE condition; 6. Returns the average value of a numeric column. SELECT AVG(column_name) FROM table_name WHERE condition; 7. Returns the total sum of a numeric column. SELECT SUM(column_name) FROM table_name WHERE condition; 8. Selects records that have matching values in both tables. SELECT column_name(s) FROM table1 INNER JOIN table2 ON table1.column_name = table2.column_name; OR SELECT column_name(s) FROM table1, table2 AND table1.column_name = table2.column_name; 9. Groups rows that have the same values into summary rows, like "find the number of customers in each country". SELECT column_name(s) FROM table_name WHERE condition GROUP BY column_name(s) DDL 1. Statement is used to create a new SQL database. CREATE DATABASE databasename; 2. Statement is used to drop an existing SQL database. DROP DATABASE databasename; 3. To Drop Table
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved