Vim Configuration Cheat Sheet Vim Configuration - This is a description of the shortcuts I use the most in my vim configuration. Note that some of this shortcuts might have been remaped and might not work in a vanilla vim configuration unless the.vimrc is changed accordingly. These notes are intended to provide a simplified crib sheet (or reminder) on SQL. It is not a tutorial. A number of examples for common types of tasks are provided - but little or no explanation. SQL - Structured Query Language - is a language understood by most database systems. In this quick reference cheat sheet, we will show Oracle SQL and PostgreSQL commands with examples. Oracle SQL Cheat Sheet. A cheat sheet is a set of notes used for quick reference. In this Oracle Cheat Sheet, I will show you all basic to advanced Oracle SQL commands with examples. To create a database, run the following command. Let’s take a look at some examples of using these SQL.Plus commands. Select empno, ename, job from emp where deptno = 30; SAVE Command. Now the above command is in the SQL.Plus buffer. You can save the buffer contents to a file using the SAVE command as shown below: SAVE F: code sqlplus empquery.sql For Linux/Unix.
- Oracle Sql Cheat Sheet Pdf
- Sqlplus Cheat Sheet Pdf
- Sqlplus Cheat Sheet Free
- Sqlplus Cheat Sheet
- Sqlplus Cheat Sheet Excel
Download this 2-page SQL Basics Cheat Sheet in PDF or PNG format, print it out, and stick to your desk.
The SQL Basics Cheat Sheet provides you with the syntax of all basics clauses, shows you how to write different conditions, and has examples. You can download this cheat sheet as follows:
You may also read the contents here:
SQL Basics Cheat Sheet
SQL
SQL, or Structured Query Language, is a language to talk to databases. It allows you to select specific data and to build complex reports. Today, SQL is a universal language of data. It is used in practically all technologies that process data.
SAMPLE DATA
QUERYING SINGLE TABLE
Fetch all columns from the country
table:
Fetch id and name columns from the city table:
Fetch city names sorted by the rating
column in the default ASCending order:
Fetch city names sorted by the rating
column in the DESCending order:
Oracle Sql Cheat Sheet Pdf
Aliases
Columns
Tables
FILTERING THE OUTPUT
COMPARISON OPERATORS
Fetch names of cities that have a rating above 3:Fetch names of cities that are neither Berlin nor Madrid:TEXT OPERATORS
Fetch names of cities that start with a 'P' or end with an 's':Fetch names of cities that start with any letter followed by'ublin' (like Dublin in Ireland or Lublin in Poland):OTHER OPERATORS
Fetch names of cities that have a population between 500K and 5M:Fetch names of cities that don't miss a rating value:Fetch names of cities that are in countries with IDs 1, 4, 7, or 8:QUERYING MULTIPLE TABLES
INNER JOIN
JOIN
(or explicitly INNER JOIN
) returns rows that have matching values in both tables.
LEFT JOIN
LEFT JOIN
returns all rows from the left table with corresponding rows from the right table. If there's no matching row, NULL
s are returned as values from the second table.
RIGHT JOIN
RIGHT JOIN
returns all rows from the right table with corresponding rows from the left table. If there's no matching row, NULL
s are returned as values from the left table.
FULL JOIN
FULL JOIN
(or explicitly FULL OUTER JOIN
) returns all rows from both tables – if there's no matching row in the second table, NULL
s are returned.
CROSS JOIN
CROSS JOIN
returns all possible combinations of rows from both tables. There are two syntaxes available.
NATURAL JOIN
NATURAL JOIN
will join tables by all columns with the same name.
NATURAL JOIN
used these columns to match rows:city.id
, city.name
, country.id
, country.name
.NATURAL JOIN
is very rarely used in practice.
Sqlplus Cheat Sheet Pdf
AGGREGATION AND GROUPING
GROUP BY
groups together rows that have the same values in specified columns. It computes summaries (aggregates) for each unique combination of values.
AGGREGATE FUNCTIONS
avg(expr)
− average value for rows within the groupcount(expr)
− count of values for rows within the groupmax(expr)
− maximum value within the groupmin(expr)
− minimum value within the groupsum(expr)
− sum of values within the group
EXAMPLE QUERIES
Find out the number of cities:
Find out the number of cities with non-null ratings:
Find out the number of distinctive country values:
Find out the smallest and the greatest country populations:
Find out the total population of cities in respective countries:
Find out the average rating for cities in respective countries if the average is above 3.0:
SUBQUERIES
Sqlplus Cheat Sheet Free
A subquery is a query that is nested inside another query, or inside another subquery. There are different types of subqueries.
SINGLE VALUE
The simplest subquery returns exactly one column and exactly one row. It can be used with comparison operators =
, <
, <=
, >
, or >=
.
This query finds cities with the same rating as Paris:
Sqlplus Cheat Sheet
MULTIPLE VALUES
A subquery can also return multiple columns or multiple rows. Such subqueries can be used with operators IN
, EXISTS
, ALL
, or ANY
.
This query finds cities in countries that have a population above 20M:
CORRELATED
A correlated subquery refers to the tables introduced in the outer query. A correlated subquery depends on the outer query. It cannot be run independently from the outer query.
This query finds cities with a population greater than the average population in the country:
This query finds countries that have at least one city:SET OPERATIONS
Set operations are used to combine the results of two or more queries into a single result. The combined queries must return the same number of columns and compatible data types. The names of the corresponding columns can be different
Sqlplus Cheat Sheet Excel
UNION
UNION
combines the results of two result sets and removes duplicates. UNION ALL
doesn't remove duplicate rows.
This query displays German cyclists together with German skaters:
INTERSECT
INTERSECT
returns only rows that appear in both result sets.
This query displays German cyclists who are also German skaters at the same time:
EXCEPT
EXCEPT
returns only the rows that appear in the first result set but do not appear in the second result set.
This query displays German cyclists unless they are also German skaters at the same time: