Skip to content
all things sql website logo

All Things SQL

All Things Related To SQL, Databases & Cloud Based Solutions

  • Home
  • What is SQL?
  • Contact
  • About
  • Privacy Policy / Disclaimer

Getting Today’s Date in SQL

Each type of database has it’s own way to extract today’s date using SQL. Here’s a quick cheat-sheet of the SQL functions used to get today’s date from the most popular relational databases.

SELECT <insert date function> FROM <table>

  • SQL Server, Azure SQL DB – GETDATE()
  • Amazon Redshift, MariaDB, MySQL, Oracle, Postgres, SQLite – CURRENT_DATE
  • MariaDB, Oracle – SYSDATE
  • MariaDB, MySQL – CURDATE()
  • DB2 – CURRENT DATE

Start Learning SQL

  • SELECT – Start Here
  • DISTINCT and COUNT – The Basics
  • WHERE – Using Filters
  • AND Versus OR Operators
  • Parentheses – Order of Operations
  • JOIN – Inner Join and Aliases
  • WHERE – Joining Tables
  • JOIN – Left, Right, and Full Outer
  • GROUP BY – Count, Sum, and More
  • HAVING – Filtering Aggregates
  • ORDER BY – Sorting Results
  • UNION ALL – Combining Datasets
  • MINUS – Subtracting Datasets

Advanced SQL

  • CAST & CONVERT – Modifying Data Types
  • CONCAT – Combining Multiple Columns
  • INSERT – Using SELECT Statement
  • CASE Statement – Replacing If-Else
  • LEAD() Function – Getting Next Values
  • LAG() Function – Getting Previous Values

DML & DDL Examples

  • DDL vs DML – A Comparison
  • CREATE TABLE – Examples
  • ALTER TABLE – Add, Drop, & Modify Columns
  • TRUNCATE vs DELETE – Erasing Tables
  • DROP – Tables, Views, Etc. – Deleting Objects

Common SQL Problems

  • Finding Duplicates
  • Getting Today’s Date

Data Warehousing

  • Fact Tables vs Dimension Tables
  • Slowly Changing Dimensions
  • OLAP vs OLTP Databases
Copyright © 2023 All Things SQL. All rights reserved.
Theme: ColorMag by ThemeGrill. Powered by WordPress.