Database.Guide

Skip to content

Beginners

  • What is a Database?
  • Database Tutorial

SQL

  • SQL Tutorial
  • SQL Reference
  • SQL Joins Tutorial
  • SQL Transactions Tutorial
  • Basic SQL Queries

Categories

  • Azure SQL Edge (17)
  • Database Concepts (99)
  • Database Tools (72)
  • DBMS (9)
  • DuckDB (161)
  • MariaDB (424)
  • Microsoft Access (17)
  • MongoDB (265)
  • MySQL (602)
  • NoSQL (8)
  • Oracle (301)
  • PostgreSQL (480)
  • Redis (210)
  • SQL (697)
  • SQL Server (1,170)
  • SQLite (299)

Tag: how to

Get the Number of Failed Login Attempts for a Login due to a Wrong Password in SQL Server (T-SQL)

Posted on October 29, 2021 by Ian

In SQL Server, you can use the LOGINPROPERTY() to return information about login policy settings.

This includes being able to return data for bad password attempts, as well as the time of the last failed login attempt due to a bad password.

Continue reading →
SQL Server how to, mssql, security, t-sql

Format Numbers with Commas in PostgreSQL

Posted on October 28, 2021 by Ian

In PostgreSQL, we can use the TO_CHAR() function to format numbers in a given format. This includes formatting numbers with commas in the relevant location.

PostgreSQL also has a money data type, which outputs the value using the current locale. This can include commas in the appropriate place, based on the locale being used.

Continue reading →
PostgreSQL how to, number format

How to Get the Day, Month, and Year from a Date in SQL

Posted on October 28, 2021 by Ian

Most of the major RDBMSs have functions that enable us to extract the day, month, and year from datetime values.

Some RDBMSs provide multiple ways to do this, and others are more limited. Below are examples of extracting the day, month, and year from date values in some of the most popular RDBMSs.

Continue reading →
MariaDB, MySQL, Oracle, PostgreSQL, SQL Server date format, dates, how to

How to Format Numbers with Commas in SQL Server

Posted on October 27, 2021October 27, 2021 by Ian

SQL Server provides us with a quick and easy way to format numbers with commas inserted at the relevant place. For example, 1234.56 can become 1,234.56. Or it can become 1.234,56, if that’s the locale that you’re using.

Continue reading →
SQL Server how to, number format

How to Get the Short Month Name in SQL

Posted on October 27, 2021 by Ian

Below are examples that demonstrate how to use SQL to return the short month name from a date in the major RDBMSs.

Continue reading →
MariaDB, MySQL, Oracle, PostgreSQL, SQL Server date format, how to

2 Ways to Concatenate Strings and Numbers in MariaDB

Posted on October 26, 2021 by Ian

Here are two ways to concatenate strings and numbers in MariaDB:

  • Use the CONCAT() function, which concatenates its arguments.
  • Use the pipe concatenation operator (||), which concatenates its operands.

Below are examples of each.

Continue reading →
MariaDB how to

Format Numbers with a Comma in SQLite

Posted on October 26, 2021March 11, 2022 by Ian

SQLite has a printf() function or format() function that allows us to format numbers according to a format string.

As from SQLite 3.18.0, it accepts a comma flag, which enables us to have comma separators at the thousands marks for integers.

Further work can be done to get it working with real/floating point numbers.

Continue reading →
SQLite how to, number format

Format a Number as Currency in SQLite

Posted on October 25, 2021March 11, 2022 by Ian

SQLite has a PRINTF() function (and now a FORMAT() function) that allows us to format a number based on a format string. For example, we can use this to format the number to a given number of decimal places, plus add a currency symbol to it.

Continue reading →
SQLite how to, number format

Concatenate a String and a Number in MySQL

Posted on October 24, 2021 by Ian

There are a couple of approaches we can use to concatenate strings and numbers in MySQL.

  • We can use the CONCAT() function, which concatenates its arguments.
  • We can use the pipe concatenation operator (||), which concatenates its operands.

Below are examples of each.

Continue reading →
MySQL how to

2 Functions that Get the Day, Month, and Year from a Date in Oracle

Posted on October 24, 2021 by Ian

Oracle Database has the TO_CHAR(datetime) function that enables us to get various date parts from a datetime value.

There’s also the EXTRACT(datetime) function that extracts a specific datetime unit (e.g. day, month, year, etc).

Continue reading →
Oracle date format, dates, how to
  • «
  • 1
  • …
  • 104
  • 105
  • 106
  • 107
  • 108
  • …
  • 182
  • »

About Database.Guide | Privacy Policy