



























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
This document is about some of the MySql commands.
Typology: Cheat Sheet
1 / 35
This page cannot be seen from the preview
Don't miss anything!
In SQL, the 'Create Database' statement is a first step for storing the structured data in the database.
CREATE DATABASE Database_Name;
SQL CREATE TABLE statement is used to create table in a database.
The SELECT statement is used to select data from a database.
SELECT column1, column2, ... FROM table_name;
The WHERE clause is used to filter records. It is a data manipulation language statement.
SELECT column1, column2, ... FROM table_name WHERE condition;
WHERE column LIKE pattern;
The ORDER BY keyword is used to sort the result-set in ascending or descending order.
SELECT column1, column2, ... FROM table_name ORDER BY column1, column2, ... ASC|DESC;
The IN operator allows you to specify multiple values in a WHERE clause.
SELECT column_name(s) FROM table_name WHERE column_name IN (value1, value2, ...);
The UPDATE command is used to update existing rows in a table.
The COUNT () function returns the number of rows that matches a specified criterion.
The SUM () function returns the total sum of a numeric column.
The MIN () function returns the smallest value of the selected column.
The MAX () function returns the largest value of the selected column.
The GROUP BY statement is often used with aggregate functions (COUNT (), MAX (), MIN (), SUM (), AVG ()) to group the result-set by one or more columns.
The NOT NULL constraint enforces a column to not accept NULL values, which means that you cannot insert or update a record without adding a value to this field.
The DEFAULT constraint provides a default value for a column.
The UNIQUE constraint ensures that all values in a column are unique.
The PRIMARY KEY constraint uniquely identifies each record in a table.A table can have only one primary key, which may consist of one single or of multiple fields.
The CHECK constraint limits the value that can be placed in a column.