Most RDBMSs provide at least a few ways to return rows that contain uppercase characters. Here are some options available in the major RDBMSs.
Continue readingTag: sql
Find Rows that Contain Lowercase Characters in SQL
Most RDBMSs provide at least a few ways to return rows that contain lowercase characters. Here are some options available in the major RDBMSs.
Continue readingSQL CASE Statement
In SQL, the CASE
statement evaluates a list of conditions and returns one of multiple possible result expressions.
In some ways, the SQL CASE
statement is kind of similar to the IF...ELSE
statement in that it allows us to check for a given condition and return a different result depending on the outcome.
How to Check a Column’s Data Type in SQL
In SQL, the columns
information schema view, which returns information about columns, is an ISO standard view that is supported by most of the major RDBMSs. You can use this view to get information about a column’s data type.
Most of the major RDBMs also provide other methods for getting column information.
Here are examples of getting the data type of a column in various SQL databases.
Continue readingSET SQLBLANKLINES: How to Allow Blank Lines in SQLcl & SQL*Plus
If you’re trying to run a multi-line query in SQLcl or SQL*Plus, and you keep getting an error such as “Unknown Command”, but running it in SQL Developer causes no such error, maybe this post will help.
By default, SQLcl and SQL*Plus don’t allow blank lines in SQL statements. However, you can change this with the SET SQLBLANKLINES
command.
Rename a Column in SQL Server (T-SQL)
In SQL Server, you can use the sp_rename
stored procedure to rename an object, including a column.
Join 3 Tables in SQL
In SQL, you can join three tables or more by adding another join after the first one.
You can also run nested joins by specifying one join as the join condition for another.
Continue readingCreate a Relationship in SQL
In SQL, you create a relationship by creating a foreign key constraint.
More specifically, you have a parent table and a child table. The parent contains the primary key, and the child table contains a foreign key that references the primary key of the parent table.
When you use SQL to create a relationship, you can create the relationship at the time you create the table, or you can create it later (by altering the table). This article covers both scenarios.
Continue readingSQL Reference for Beginners
This page contains direct links to SQL tutorials and reference articles for beginners.
Continue readingHow to Rename a Table in SQL
In SQL, most RDBMSs allow you to rename a table using the ALTER TABLE
statement, which is the statement used to modify the definition of an existing table.
Some RDBMs also include a RENAME
statement for renaming tables.
But if you use SQL Server, you’ll need to use the sp_rename
stored procedure.