SQL
WHERE Clause

WHERE clause is used to filter records, and extract only the specific data that we want in any special case.

Operators of WHERE Clause

Below are operators that could be used with where clause in SQL.

OperatorDescription
=Equal
< >Not equal its is some time is used as !
>Greater than
<Less than
>=Greater than or equal
<=Less than or equal
BETWEENBetween a certain range
LIKESearch for a pattern
INTo specify multiple possible values for a column

Basic Syntax

SELECT statement can be used to select single column from a database.

Let’s assume we have a table named as customers and this table having multiple columns like customer_name, customer_address, customer_contact_no. We want to select all the data of customer the above select statement will be utilized.


	SELECT column1, column2....columnN
	FROM table_name
	WHERE condition;

Examples

Select all the customers who belongs to Pakistan.


	SELECT * FROM Customers
	WHERE Country='pakistan';

Select a customer by ID.


	SELECT * FROM Customers
	WHERE CustomerID=20;


SQL
SELECT Statement

There are multiple ways to use SELECT statement in SQL.

Select Single Columns

SELECT statement can be used to select single column from a database.

For instance, If we only want to see the customers names from customers table.


	SELECT column_name FROM table_name;

Select Multiple Columns

SELECT statement can be used to select single column from a database.

Let’s assume we have a table named as customers and this table having multiple columns like customer_name, customer_address, customer_contact_no. We want to select all the data of customer the above select statement will be utilized.


	SELECT column1, column2....columnN
	FROM table_name;

Select All Columns

SELECT statement can used to select whole data from a database.


SQL
UPDATE Statement

UPDATE statement is used to edit the records of a table.

with WHERE

Syntax

 

    UPDATE table_name
    SET column1 = value1, column2 = value2, ...
    WHERE condition;

Example

  UPDATE Customers
	SET CustomerName = 'john', City= 'Austria'
	WHERE CustomerID = 6;

without WHERE

Whenever we use UPDATE Statement without WHERE clause it will Update all the records in the table.

Syntax


    UPDATE table_name
    SET column1 = value1, column2 = value2...;

Example

 

  UPDATE Customers
  SET CustomerName='john';

  

SQL
INSERT INTO Statement

INSERT INTO statement is used to insert the records in table. We can insert records in table in two ways, the most commonly used way for insert is to specify both the column names and values.

All Columns

In this method there is no need to specify the column names in SQL query, however make sure the order of the values and columns.

Syntax

  INSERT INTO table_name
  VALUES (value1, value2, value3, ...);

 

Example

  INSERT INTO Customers
  VALUES ('john', 'Michel john ', 'St 55', 'louse angelus', '4900', 'USA');

Selective Columns

Syntax

  INSERT INTO table_name (column1, column2, column3, ...)
  VALUES (value1, value2, value3, ...); 

 

Example

    INSERT INTO Customers (CustomerName, ContactName, Address, City, PostalCode, Country)
    VALUES ('john', 'Michel john ', 'St 55', 'louse angelus', '4900', 'USA');

Introduction to
SQL

SQL is a standard language for sorting, manipulating and retrieving data from databases. SQL stands for Structured Query Language that let you access and manipulate databases.

Power of SQL:

  • SQL can execute queries against a database
  • SQL is used to insert data into a database
  • SQL is used to retrieve data from a database
  • SQL is used to update/edit data of a database
  • SQL is used to delete/remove data of a database
  • SQL is used to create database and tables
  • SQL is used to create stored procedures
  • SQL is used to create view in a database
  • SQL is used to set permission on tables, procedures and views

Commands of SQL

Below are some most important and basic commands of SQL.

CommandDescription
SELECTIt extracts data from a database
UPDATEIt updates data in a database
DELETEIt deletes data from a database
INSERT INTOIt inserts new data into a database
CREATE DATABASEIt creates a new database
ALTER DATABASEIt modifies a database
CREATE TABLEIt creates a new table
ALTER TABLEIt modifies a table
DROP TABLEIt deletes a table
CREATE INDEXIt creates an index
DROP INDEXIt deletes an index


HTML
YouTube

YouTube videos can be embedded into website by using either the iframe or object HTML tags.

YouTube by Iframe

Below example will demonstrate the basic architecture of HTML Comments.

<!doctype html>  
<html>
    <head>
        <title>YouTube by Iframe</title>
    </head>

    <body>
        <iframe src="https://youtu.be/XDYn3ML3beA" width="560" height="315" frameborder="0" allowfullscreen></iframe>
    </body>
</html>

YouTube by Object

Below example will demonstrate the basic architecture of HTML Comments.

<!doctype html>  
<html>
    <head>
        <title>YouTube by Object</title>
    </head>

    <body>
        <object data="https://youtu.be/XDYn3ML3beA" width="560" height="315"></object>
    </body>
</html>


HTML
Video

The HTML <video> tag is used to embed a media player which supports video playback into the website.

Video Breakdown

Here is the breakdown of HTML Video.

Video Attributes

AttributeDescription
srcIt specifies the URL
widthIt specifies the width
autoplayIt specifies that the video will play automatically
controlsIt specifies that the video controls get displayed
heightIt specifies the height
loopIt specifies that the video will start again every time after finish
mutedIt specifies that the audio should be muted
posterIt specifies the image to be shown while the video is downloading
preloadIt specifies how and when the video file should load

Video Example

Below example will demonstrate the basic architecture of HTML Video.

<!doctype html>  
<html>
    <head>
        <title>HTML Comment Example</title>
    </head>
  
    <body>
        <video controls>
            <source src="intro.webm" type='video/webm;codecs="vp8, vorbis"'/>
        </video>
    </body>
</html>


HTML
Tables

Tables are utilized in HTML documents (web pages) to present tabular data. The HTML tables allow website authors to arrange data or record like text, links, images, other tables, etc. into rows and columns of cells.

In HTML, we create tables using the <table> tag, in conjunction with the <tr> and <td>.

Each set of <tr> tags (opening and shutting tags) represents a row within the table that they’re nested in. And each set of <td> tags represents a table data cell among the row that they’re nested in.

You can conjointly add table headers using the <th> element.

Breakdown

Here is the breakdown of HTML Table

Table Example

Below example will demonstrate the basic architecture of Table

<!doctype html>  
<html>
    <head>
        <title>Table Example</title> 
    </head>
  
    <body>
        <table>
            <tr>
                <th>Heading</th>
            </tr>
       
            <tr>
                <td>Content</td>
            </tr>
        </table>
    </body>
</html>