0% found this document useful (0 votes)
40 views1 page

Amir' 'Dalya' 'Amir': Commands and Stuff

This document contains a summary of MySQL commands and functions: - SQL code must be written in uppercase. Fields can be defined using backticks and separated with commas. The SELECT command is used to select tables and values. LIMIT and OFFSET can limit and skip rows displayed. ORDER BY sorts the results in ascending or descending order. - WHERE filters results by comparing fields using operators like =. AND and OR add multiple filters. LIKE searches for text, and % acts as a wildcard. Commands like SELECT, FROM, WHERE, AND, OR, LIKE allow querying and filtering table data.

Uploaded by

Pain Killers
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
0% found this document useful (0 votes)
40 views1 page

Amir' 'Dalya' 'Amir': Commands and Stuff

This document contains a summary of MySQL commands and functions: - SQL code must be written in uppercase. Fields can be defined using backticks and separated with commas. The SELECT command is used to select tables and values. LIMIT and OFFSET can limit and skip rows displayed. ORDER BY sorts the results in ascending or descending order. - WHERE filters results by comparing fields using operators like =. AND and OR add multiple filters. LIKE searches for text, and % acts as a wildcard. Commands like SELECT, FROM, WHERE, AND, OR, LIKE allow querying and filtering table data.

Uploaded by

Pain Killers
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 1

MYSQL WEB5

Commands and stuff

 This to note: SQL code must be written in all CAPS letters


 You can define more than a field in a table simply by typing the field name in a back-Ticks
`Amir`
 You can separate field names from each other simply by adding a coma in between such as
`Dalya` , `Amir`
 SELECT: used to select tables and values inside a table like table rows and columns
 SELECT *: selects everything in the specified table
 LIMIT: limits the values that are shown when running the SQL code
o A LIMIT of 5 only shows the first 5 values in a table
 OFFSET: skips the specified field to the value that you have typed in
o An OFFSET of 5 skips the numbers (1,2,3,4,5) and starts the table at 6
 You can rearrange fields in a table by typing their names in the order you want in a SQL inputbox
o Let’s say you have a table include username and age, gender if you run it will display as
( username | age | gender ) you can rearrange that by typing (SELECT `age` , `gender`,
`username` ) and it will display as ( age | gender | username )
 ORDER BY: orders the selected field in Ascending order
 ORDDR BY DESC: orders the selected field in Descending order
o Note ORDER BY must contain a value such as
ORDER BY `username` DESC
o Descending means (Z-A) and (100…-1)
o Ascending means (A-Z) and (1-100…)
 WHERE: this value/command is used to look for a specified field in a table or add a comparison
in a table using math operators
o Example: SELECT `Student` FROM `NET` WHERE `id` = 14
 This will show you the student with an Id number of 14
 AND / OR: the commands are used to add more than one filter to a query, the AND clause work
by adding another filter on top of an existing one. The OR clause works by adding an ultimatum
over the existing filter
 Like and Wildcard
o Like command is used to search for specified text in the selected table row or column
o Wildcard “%” is defined with a percentage sign is used with Like command it’s
used to tell your query that their might be another word before or after or both of the
word that you are looking for.
 Example if a field contains a single name such as Amir we use the like command
as such SELECT * FROM `students` WHERE `names` LIKE ‘Amir’
 Example 2 if a field contains more than one text such as Amir Khalid Hamadamin
and we are looking for the word Khalid we use it as such SELECT * FROM
`students` WHERE `names` LIKE ‘%Khalid%’

You might also like