SQL Tutorials for Citizen Data Scientists

Learn to Code SQL Example – SQL | Numeric Functions

Hits: 20 (SQL Example for Citizen Data Scientist & Business Analyst)   SQL | Numeric Functions Numeric Functions are used to perform operations on numbers and return numbers. Following are the numeric functions defined in SQL: ABS(): It returns the absolute value of a number. Syntax: SELECT ABS(-243.5); Output: 243.5 SQL> SELECT ABS(-10); +————————————–+ | ABS(10) +————————————–+ | …

Learn to Code SQL Example – SQL | Date functions

Hits: 10 (SQL Example for Citizen Data Scientist & Business Analyst)   SQL | Date functions In SQL, dates are complicated for newbies, since while working with database, the format of the date in table must be matched with the input date in order to insert. In various scenarios instead of date, datetime (time is …

Learn to Code SQL Example – SQL Server Mathematical functions (SQRT, PI, SQUARE, ROUND, CEILING & FLOOR)

Hits: 8 (SQL Example for Citizen Data Scientist & Business Analyst)   SQL Server Mathematical functions (SQRT, PI, SQUARE, ROUND, CEILING & FLOOR) Mathematical functions are present in SQL server which can be used to perform mathematical calculations. Some commonly used mathematical functions are given below: 1. SQRT(): SQRT() function is the most commonly used …

Learn to Code SQL Example – SQL | Join (Inner, Left, Right and Full Joins)

Hits: 11 (SQL Example for Citizen Data Scientist & Business Analyst)   SQL | Join (Inner, Left, Right and Full Joins) A SQL Join statement is used to combine data or rows from two or more tables based on a common field between them. Different types of Joins are: INNER JOIN LEFT JOIN RIGHT JOIN FULL …

Learn to Code SQL Example – SQL | BETWEEN & IN Operator

Hits: 4 (SQL Example for Citizen Data Scientist & Business Analyst)   SQL | BETWEEN & IN Operator BETWEEN The SQL BETWEEN condition allows you to easily test if an expression is within a range of values (inclusive). The values can be text, date, or numbers. It can be used in a SELECT, INSERT, UPDATE, …

Learn to Code SQL Example – SQL | Except Clause

Hits: 5 (SQL Example for Citizen Data Scientist & Business Analyst) SQL | Except Clause In SQL, EXCEPT returns those tuples that are returned by the first SELECT operation, and not returned by the second SELECT operation. This is the same as using a subtract operator in relational algebra. Example: Say we have two relations, …

Learn to Code SQL Example – SQL | MINUS Operator

Hits: 3 (SQL Example for Citizen Data Scientist & Business Analyst)   SQL | MINUS Operator The Minus Operator in SQL is used with two SELECT statements. The MINUS operator is used to subtract the result set obtained by first SELECT query from the result set obtained by second SELECT query. In simple words, we …

Learn to Code SQL Example – SQL | LIKE

Hits: 4 (SQL Example for Citizen Data Scientist & Business Analyst)   SQL | LIKE Sometimes we may require tuples from the database which match certain patterns. For example, we may wish to retrieve all columns where the tuples start with the letter ‘y’, or start with ‘b’ and end with ‘l’, or even more …

Learn to Code SQL Example – SQL | LIMIT Clause

Hits: 6 (SQL Example for Citizen Data Scientist & Business Analyst)   SQL | LIMIT Clause If there are a large number of tuples satisfying the query conditions, it might be resourceful to view only a handful of them at a time. The LIMIT clause is used to set an upper limit on the number …

Learn to Code SQL Example – SQL | Join (Cartesian Join & Self Join)

Hits: 6 (SQL Example for Citizen Data Scientist & Business Analyst)   SQL | Join (Cartesian Join & Self Join) In this article, we will discuss about the remaining two JOINS: CARTESIAN JOIN SELF JOIN   Consider the two tables below: StudentCourse CARTESIAN JOIN: The CARTESIAN JOIN is also known as CROSS JOIN. In a …

Learn to Code SQL Example – SQL | ALTER (ADD, DROP, MODIFY)

Hits: 4 (SQL Example for Citizen Data Scientist & Business Analyst)   SQL | ALTER (ADD, DROP, MODIFY) ALTER TABLE is used to add, delete/drop or modify columns in the existing table. It is also used to add and drop various constraints on the existing table. ALTER TABLE – ADD ADD is used to add …

Learn to Code SQL Example – SQL | CREATE

Hits: 5 (SQL Example for Citizen Data Scientist & Business Analyst)   SQL | CREATE There are two CREATE statements available in SQL: CREATE DATABASE CREATE TABLE   CREATE DATABASE A Database is defined as a structured set of data. So, in SQL the very first step to store the data in a well structured manner is …

Learn to Code SQL Example – SQL | ALTER (RENAME)

Hits: 3 (SQL Example for Citizen Data Scientist & Business Analyst)   SQL | ALTER (RENAME) Sometimes we may want to rename our table to give it a more relevant name. For this purpose we can use ALTER TABLE to rename the name of table. *Syntax may vary in different databases. Syntax(Oracle,MySQL,MariaDB): ALTER TABLE table_name RENAME TO …

Learn to Code SQL Example – SQL | DROP, TRUNCATE

Hits: 1 (SQL Example for Citizen Data Scientist & Business Analyst)   SQL | DROP, TRUNCATE DROP DROP is used to delete a whole database or just a table.The DROP statement destroys the objects like an existing database, table, index, or view. A DROP statement in SQL removes a component from a relational database management system …

Learn to Code SQL Example – SQL | Create Table

Hits: 3 (SQL Example for Citizen Data Scientist & Business Analyst)   SQL | Create Table Extension SQL provides an extension for CREATE TABLE clause that creates a new table with the same schema of some existing table in the database. It is used to store the result of complex queries temporarily in a new table. The …

Learn to Code SQL Example – SQL | SELECT Query

Hits: 8 (SQL Example for Citizen Data Scientist & Business Analyst)   SQL | SELECT Query Select is the most commonly used statement in SQL. The SELECT Statement in SQL is used to retrieve or fetch data from a database. We can fetch either the entire table or according to some specified rules. The data …