SQL: Tips and Tricks

  1. Reset Root Password in MySQL on Windows

    Forgetting your MySQL root password can be scary, but thankfully there is a way to reset it. In this brief article, we will show you how.

  2. How to Create an ER Diagram for a MySQL Database with Free Tools

    In our Introduction to PHP course, students create a poetry website. For the manual, I needed to create an ER diagram for the MySQL database on a Mac. I found the following options, both of which are free:

  3. How to Round Up in SQL

    In SQL, you round up to the nearest integer using the CEIL or CEILING function, depending on whether you're using SQL Server, Oracle, MySQL or PostgreSQL.

  4. How to Concatenate Strings in SQL

    SQL Server, Oracle, MySQL and PostgreSQL each have their own way of doing string concatenation.

  5. How to Select All Columns in a Row in SQL

    You might wish to select all the columns in each row of a table in your SQL select statement. The syntax for accomplishing this task is straightforward because it does not require itemizing each column defined for the table.

  6. How to Check Multiple Conditions in SQL

    A select statement in SQL may contain one or more conditions (also known as predicates) in the where clause. A condition evaluates to true or false or unknown. The where clause must return a true value for a particular row to be selected.

  7. How Work with White Space and Semicolons in Simple SQL Selects

    You must use at least one white space character between each keyword, table or column name in an SQL select. In addition, a semicolon is required as the statement delimiter.

  8. How to Sort Records in SQL

    When you run a select statement the records, or rows, that are displayed are not guaranteed to be in a specific order. Usually, you will want to sort the records to make the report more meaningful. You will learn how to sort records in this topic.

  9. How to Write Subqueries (Simple and Correlated)

    A subquery is select statement contained within an outer select statement. Two types of subqueries are available in SQL: the simple subquery and the correlated subquery. In this topic you will learn how to write each type of subquery.