Simple Queries in SQL

SQL is a standard query language to access the databases such as MySQL, Access, Oracle, etc. A database is used to house data in the form of tables. The CREATE DATABASE command is used to create a database. In order to make queries upon the data in tables of a database, one needs to open the database for use. To access the database, log into MySQL and issue a command:USE ; Simple SQL Queries include Accessing Database, SELECT command, Selecting all columns, DISTINCT keyword, Viewing structure of table, Simple calculations, Using column aliases, Handing Nulls, WHERE clause, Relational operators, Logical operators, BETWEEN Operator, Operator precedence, ORDER BY clause. The CREATE TABLE command is used to create a table in a database. he SELECT command is used to view contents of the table. The DESCRIBE or DESC command enables us to see the structure of a table in the CREATE statement. The DISTINCT keyword eliminates the duplicate values in the result. The ALL keyword displays all the values including duplicate values. Arithmetic operators perform mathematical calculations. To perform calculations in SQL, there are two options Write expression with SELECT, Use table Dual (in FROM clause) The AS keyword is used to create a temporary name for columns or tables. The WHERE clause filters the records. It extracts only those records that fulfill a specified criterion.

Operators include relational operators, logical operators, BETWEEN operator, IN operator and LIKE operator. The BETWEEN operator defines the range of values within which the column values must fall into to make the condition true. The IN operator is used to specify a list of values. The LIKE clause is used to select rows containing columns that match a wildcard pattern. When evaluating an expression containing multiple operators, operators with higher precedence are evaluated before evaluating those with lower precedence.

To Access the full content, Please Purchase