Day: February 2, 2021

Learn to Code SQL Example – SQL | UNIQUE Constraint

Hits: 5 (SQL Example for Citizen Data Scientist & Business Analyst)   SQL | UNIQUE Constraint Unique constraint in SQL is used to check whether the sub query has duplicate tuples in it’s result. It returns a boolean value indicating the presence/absence of duplicate tuples. Unique construct returns true only if the sub query has …

Learn to Code SQL Example – SQL | Distinct Clause

Hits: 8 (SQL Example for Citizen Data Scientist & Business Analyst) SQL | Distinct Clause The distinct keyword is used in conjunction with select keyword. It is helpful when there is need of avoiding the duplicate values present in any specific columns/table. When we use distinct keyword only the unique values are fetched. Basic Syntax: SELECT …

Learn to Code SQL Example – SQL | Case Statement

Hits: 3 (SQL Example for Citizen Data Scientist & Business Analyst)   SQL | Case Statement Control statements form the heart of most languages since they control the execution of other sets of statements. These are found in SQL too, and should be exploited for uses such as query filtering and query optimization through careful …

Learn to Code SQL Example – SQL | WHERE Clause

Hits: 8 (SQL Example for Citizen Data Scientist & Business Analyst)   SQL | WHERE Clause WHERE keyword is used for fetching filtered data in a result set. It is used to fetch data according to a particular criteria. WHERE keyword can also be used to filter data by matching patterns.   Basic Syntax: SELECT column1,column2 FROM …

Learn to Code SQL Example – SQL | AND and OR operators

Hits: 4 (SQL Example for Citizen Data Scientist & Business Analyst)   SQL | AND and OR operators In SQL, the AND & OR operators are used for filtering the data and getting precise result based on conditions. The AND and OR operators are used with the WHERE clause. These two operators are called conjunctive operators. …

Learn to Code SQL Example – SQL | INSERT INTO Statement

Hits: 2 (SQL Example for Citizen Data Scientist & Business Analyst)   SQL | INSERT INTO Statement The INSERT INTO statement of SQL is used to insert a new row in a table. There are two ways of using INSERT INTO statement for inserting rows: Only values: First method is to specify only the value of …

Learn to Code SQL Example – SQL | DELETE Statement

Hits: 4 (SQL Example for Citizen Data Scientist & Business Analyst)   SQL | DELETE Statement The DELETE Statement in SQL is used to delete existing records from a table. We can delete a single record or multiple records depending on the condition we specify in the WHERE clause. Basic Syntax: DELETE FROM table_name WHERE …

Learn to Code SQL Example – SQL | UPDATE Statement

Hits: 4 (SQL Example for Citizen Data Scientist & Business Analyst)   SQL | UPDATE Statement The UPDATE statement in SQL is used to update the data of an existing table in database. We can update single columns as well as multiple columns using UPDATE statement as per our requirement. Basic Syntax UPDATE table_name SET …

Learn to Code SQL Example – SQL | SELECT TOP Clause

Hits: 3 (SQL Example for Citizen Data Scientist & Business Analyst)   SQL | SELECT TOP Clause SELECT TOP clause is used to fetch limited number of rows from a database. This clause is very useful while dealing with large databases. Basic Syntax: SELECT TOP value column1,column2 FROM table_name; value: number of rows to return …

Learn to Code SQL Example – SQL | ORDER BY

Hits: 3 (SQL Example for Citizen Data Scientist & Business Analyst)   SQL | ORDER BY The ORDER BY statement in sql is used to sort the fetched data in either ascending or descending according to one or more columns. By default ORDER BY sorts the data in ascending order. We can use the keyword DESC …

Learn to Code SQL Example – SQL | Aliases

Hits: 3 (SQL Example for Citizen Data Scientist & Business Analyst)   SQL | Aliases Aliases are the temporary names given to table or column for the purpose of a particular SQL query. It is used when name of column or table is used other than their original names, but the modified name is only …

Learn to Code SQL Example – SQL | Intersect and Except clause

Hits: 2 (SQL Example for Citizen Data Scientist & Business Analyst)   SQL | Intersect & Except clause 1. INTERSECT clause : As the name suggests, the intersect clause is used to provide the result of the intersection of two select statements. This implies the result contains all the rows which are common to both the …

Learn to Code SQL Example – SQL | Union Clause

Hits: 1 (SQL Example for Citizen Data Scientist & Business Analyst)   SQL | Union Clause The Union Clause is used to combine two separate select statements and produce the result set as a union of both the select statements. NOTE: The fields to be used in both the select statements must be in same …

Learn to Code SQL Example – SQL | Wildcard operators

Hits: 3 (SQL Example for Citizen Data Scientist & Business Analyst)   SQL | Wildcard operators In the above mentioned article WHERE Clause is discussed in which LIKE operator is also explained, where you must have encountered the word wildcards now lets get deeper into Wildcards. Wildcard operators are used with LIKE operator, there are …

Learn to Code SQL Example – SQL | GROUP BY

Hits: 2 (SQL Example for Citizen Data Scientist & Business Analyst)   SQL | GROUP BY The GROUP BY Statement in SQL is used to arrange identical data into groups with the help of some functions. i.e if a particular column has same values in different rows then it will arrange these rows in a …

Learn to Code SQL Example – SQL | Arithmetic Operators

Hits: 2 (SQL Example for Citizen Data Scientist & Business Analyst)   SQL | Arithmetic Operators Arithmetic Operators are: + [Addition] – [Subtraction] / [Division] * [Multiplication] % [Modulus] Addition (+) : It is used to perform addition operation on the data items, items include either single column or multiple columns. Implementation: SELECT employee_id, employee_name, salary, salary + …