Natural Language to SQL is transforming the way people interact with data by allowing users to ask questions in everyday language and receive answers from databases. This article explores how the technology works, why it matters, and how it is making data analysis more accessible for teams and organizations.
sql
2 Ways to Return the Number of Rows Changed by a SQL Statement in SQLite
SQLite provides several ways to determine how many rows are affected by SQL statements such as INSERT, UPDATE or DELETE.
One way of achieving this is with the changes() function. This function returns the number of rows modified by the most recent SQL statement executed in the current session.
Another way is with the .changes dot command.
In this article, we’ll look at an example that uses these options to get the number of rows changed by various SQL statements.
Sampling Rows from a Table in DuckDB with the SAMPLE Clause
DuckDB’s SAMPLE clause is a handy feature that allows us to work with a random subset of our data. This is particularly useful when dealing with large datasets where processing the entire dataset might be time-consuming or unnecessary for exploratory data analysis, testing queries, or creating representative samples.
When we use this clause, we can specify the absolute number of rows to return, or a percentage of rows. We also have an option of sampling method to use.
SQL 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.
SET 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.
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.