Introduction to SQL Statements
Learn and practice SQL statements.
The basic building block of SQL is a statement. Chaining multiple statements with the ; delimiter we arrive at a complete SQL script. To that extent, consider the following SQL code:
This SQL script contains three statements:
Ensuring any existing table named
date_and_timeis dropped from the database to prevent errors from attempting to create a table that already exists. It's a way to start fresh with the upcoming table definition (line 2).Defining the creation of a temporary table named
date_and_time. This table is meant to showcase various temporal data types in SQL. Each column is designed to store a different kind of temporal data (lines 5–12)Inserting a new row into the
date_and_timetable without specifying any values (VALUE ()). Due to the default values defined in the table schema, ...