yash sharma

Student at AMITY University

Skilled in HTML, CSS, Digital marketing, HTML, CSS, Digital marketing, HTML, CSS, Digital marketing, HTML, CSS, Digital marketing, HTML, CSS, Digital marketing, HTML, CSS, Digital marketing, HTML, CSS, Digital marketing, HTML, CSS, Digital marketing, HTML, CSS, Digital marketing

Certified in Google Digital Unlocked

SQL Syntax

Database Tables A database most often contains one or more tables. Each table is identified by a name (e.g. "Customers" or "Orders"). Tables contain records (rows) with data. In this tutorial we will use the well-known Northwind sample database (included in MS Access and MS SQL Server). Semicolon after SQL Statements? Some database systems require a semicolon at the end of each SQL statement. Semicolon is the standard way to separate each SQL statement in database systems that allow more than one SQL statement to be executed in the same call to the server. In this tutorial, we will use semicolon at the end of each SQL statement. ________________________________________

SQL SELECT Statement

SQL SELECT Statement The SELECT statement is used to select data from a database. The data returned is stored in a result table, called the result-set. SELECT Syntax SELECT column1, column2, ... FROM table_name; Here, column1, column2, ... are the field names of the table you want to select data from. If you want to select all the fields available in the table, use the following syntax:

The SQL ANY and ALL Operators

The SQL ANY and ALL Operators The ANY and ALL operators are used with a WHERE or HAVING clause. The ANY operator returns true if any of the subquery values meet the condition. The ALL operator returns true if all of the subquery values meet the condition.

The SQL BETWEEN Operator

The SQL BETWEEN Operator The BETWEEN operator selects values within a given range. The values can be numbers, text, or dates. The BETWEEN operator is inclusive: begin and end values are included. BETWEEN Syntax SELECT column_name(s) FROM table_name WHERE column_name BETWEEN value1 AND value2; BETWEEN Example

The SQL CASE Statement

The SQL CASE Statement The CASE statement goes through conditions and returns a value when the first condition is met (like an IF-THEN-ELSE statement). So, once a condition is true, it will stop reading and return the result. If no conditions are true, it returns the value in the ELSE clause. If there is no ELSE part and no conditions are true, it returns NULL. CASE Syntax CASE WHEN condition1 THEN result1 WHEN condition2 THEN result2 WHEN conditionN THEN resultN ELSE result END;

SQL Aliases

SQL Aliases SQL aliases are used to give a table, or a column in a table, a temporary name. Aliases are often used to make column names more readable. An alias only exists for the duration of the query. Alias Column Syntax SELECT column_name AS alias_name FROM table_name; Alias Table Syntax SELECT column_name(s) FROM table_name AS alias_name

SQL INNER JOIN Keyword

SQL INNER JOIN Keyword The INNER JOIN keyword selects records that have matching values in both tables. INNER JOIN Syntax SELECT column_name(s) FROM table1 INNER JOIN table2 ON table1.column_name = table2.column_name;

SQL ALTER TABLE Statement

SQL ALTER TABLE Statement The ALTER TABLE statement is used to add, delete, or modify columns in an existing table. The ALTER TABLE statement is also used to add and drop various constraints on an existing table. ________________________________________ ALTER TABLE - ADD Column To add a column in a table, use the following syntax: ALTER TABLE table_name ADD column_name datatype; The following SQL adds an "Email" column to the "Customers" table: Example ALTER TABLE Customers ADD Email varchar(255); ALTER TABLE - ALTER/MODIFY COLUMN

SQL Hosting

SQL Hosting If you want your web site to be able to store and retrieve data from a database, your web server should have access to a database-system that uses the SQL language. If your web server is hosted by an Internet Service Provider (ISP), you will have to look for SQL hosting plans. The most common SQL hosting databases are MS SQL Server, Oracle, MySQL, and MS Access. ________________________________________

SQL CHECK Constraint

SQL CHECK Constraint The CHECK constraint is used to limit the value range that can be placed in a column. If you define a CHECK constraint on a single column it allows only certain values for this column. If you define a CHECK constraint on a table it can limit the values in certain columns based on values in other columns in the row. ________________________________________ SQL CHECK on CREATE TABLE The following SQL creates a CHECK constraint on the "Age" column when the "Persons" table is created. The CHECK constraint ensures that you can not have any person below 18 years: MySQL: CREATE TABLE Persons ( ID int NOT NULL, LastName varchar(255) NOT NULL, FirstName varchar(255), Age int, CHECK (Age>=18) ); SQL Server / Oracle / MS Access:

SQL Comments

SQL Comments Comments are used to explain sections of SQL statements, or to prevent execution of SQL statements. Note: The examples in this chapter will not work in Firefox and Microsoft Edge! Comments are not supported in Microsoft Access databases. Firefox and Microsoft Edge are using Microsoft Access database in our examples. ________________________________________ Single Line Comments Single line comments start with --. Any text between -- and the end of the line will be ignored (will not be executed).

SQL Create Constraints

SQL constraints are used to specify rules for data in a table. ________________________________________ SQL Create Constraints Constraints can be specified when the table is created with the CREATE TABLE statement, or after the table is created with the ALTER TABLE statement. Syntax CREATE TABLE table_name ( column1 datatype constraint, column2 datatype constraint, column3 datatype constraint, .... );