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

The SQL MIN() and MAX() Functions

The SQL MIN() and MAX() Functions The MIN() function returns the smallest value of the selected column. The MAX() function returns the largest value of the selected column. MIN() Syntax SELECT MIN(column_name) FROM table_name WHERE condition; MAX() Syntax SELECT MAX(column_name) FROM table_name WHERE condition; ________________________________________

The SQL INSERT INTO SELECT Statement

The SQL INSERT INTO SELECT Statement The INSERT INTO SELECT statement copies data from one table and inserts it into another table. • INSERT INTO SELECT requires that data types in source and target tables match • The existing records in the target table are unaffected INSERT INTO SELECT Syntax Copy all columns from one table to another table: INSERT INTO table2 SELECT * FROM table1 WHERE condition; Copy only some columns from one table into another table: INSERT INTO table2 (column1, column2, column3, ...) SELECT column1, column2, column3, ... FROM table1 WHERE condition;

The SQL GROUP BY Statement

The SQL GROUP BY Statement The GROUP BY statement groups rows that have the same values into summary rows, like "find the number of customers in each country". 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. GROUP BY Syntax SELECT column_name(s) FROM table_name WHERE condition GROUP BY column_name(s) ORDER BY column_name(s)

The SQL EXISTS Operator

The SQL EXISTS Operator The EXISTS operator is used to test for the existence of any record in a subquery. The EXISTS operator returns true if the subquery returns one or more records. EXISTS Syntax SELECT column_name(s) FROM table_name WHERE EXISTS (SELECT column_name FROM table_name WHERE condition);

The SQL DROP TABLE Statement

The SQL DROP TABLE Statement The DROP TABLE statement is used to drop an existing table in a database. Syntax DROP TABLE table_name; Note: Be careful before dropping a table. Deleting a table will result in loss of complete information stored in the table

SQL Views

SQL CREATE VIEW Statement In SQL, a view is a virtual table based on the result-set of an SQL statement. A view contains rows and columns, just like a real table. The fields in a view are fields from one or more real tables in the database. You can add SQL functions, WHERE, and JOIN statements to a view and present the data as if the data were coming from one single table. SQL Updating a View A view can be updated with the CREATE OR REPLACE VIEW command. SQL CREATE OR REPLACE VIEW Syntax CREATE OR REPLACE VIEW view_name AS SELECT column1, column2, ... FROM table_name WHERE condition;

The SQL AND, OR and NOT Operators

The SQL AND, OR and NOT Operators The WHERE clause can be combined with AND, OR, and NOT operators. The AND and OR operators are used to filter records based on more than one condition: • The AND operator displays a record if all the conditions separated by AND are TRUE. • The OR operator displays a record if any of the conditions separated by OR is TRUE. The NOT operator displays a record if the condition(s) is NOT TRUE.

The SQL CREATE DATABASE Statement

The SQL CREATE DATABASE Statement The CREATE DATABASE statement is used to create a new SQL database. Syntax CREATE DATABASE databasename; ________________________________________ CREATE DATABASE Example

The SQL BACKUP DATABASE Statement

The SQL BACKUP DATABASE Statement The BACKUP DATABASE statement is used in SQL Server to create a full back up of an existing SQL database. Syntax BACKUP DATABASE databasename TO DISK = 'filepath'; The SQL BACKUP WITH DIFFERENTIAL Statement A differential back up only backs up the parts of the database that have changed since the last full database backup. Syntax BACKUP DATABASE databasename TO DISK = 'filepath' WITH DIFFERENTIAL;

SQL LEFT JOIN Keyword

SQL LEFT JOIN Keyword The LEFT JOIN keyword returns all records from the left table (table1), and the matched records from the right table (table2). The result is NULL from the right side, if there is no match. Demo Database In this tutorial we will use the well-known Northwind sample database. Below is a selection from the "Customers" table: SQL LEFT JOIN Example The following SQL statement will select all customers, and any orders they might have:

SQL Working With Dates

SQL Working With Dates SQL Dates The most difficult part when working with dates is to be sure that the format of the date you are trying to insert, matches the format of the date column in the database. As long as your data contains only the date portion, your queries will work as expected. However, if a time portion is involved, it gets more complicated.

SQL AUTO INCREMENT Field

SQL AUTO INCREMENT Field AUTO INCREMENT Field Auto-increment allows a unique number to be generated automatically when a new record is inserted into a table. Often this is the primary key field that we would like to be created automatically every time a new record is inserted. ________________________________________ Syntax for MySQL The following SQL statement defines the "Personid" column to be an auto-increment primary key field in the "Persons" table: