The ‘Database’ Archives
Posted September 13, 2012 by

SQL Server: Use a CASE Expression in an Update Statement

mssql-logo

The CASE expression is used to compare one expression with a set of expressions in SQL. The result of the CASE expression is a Boolean value, true or false. We can use various DML statements like INSERT, SELECT, DELETE and UPDATE with a CASE statement. In this Tech-Recipes tutorial, we will see how to use [...]

Category Database

Posted May 10, 2012 by

SQL Server: Useful Metadata queries

mssql-logo

Metadata queries are really helpful in discovering information for a given database schema. Database information including the tables, views, columns names, data types, indexes, and table constraints are all available using queries such as these.

Category Database

Posted May 4, 2012 by

SQL Server: Generate Insert Statement Script

sql-feature

When running reports, for example, the same insert statements need to be created over and over again. SQL Server includes a great feature to generate these insert statements automatically.

Category Database

Posted April 19, 2012 by

SQL Server – Dealing with NULL values when sorting

mssql-logo

When working with NULL values, it’s important how you deal with NULL records in your database. This example walks through and explains how to sort and separate NULL and non-NULL values. This example should work with all database types including MySQL, MS SQL, and postgreSQL.

Category Database

Posted March 27, 2012 by

MySQL: Datetime Versus Timestamp Data Types

The temporal data types in MySQL can be confusing. Hopefully, this example and discussion will help to explain the differences in the timestamp and datetime data types.

Category MySQL

Posted February 18, 2012 by

How to Create a Basic MySQL Table

Creating tables in databases is an important first step for storing data. The CREATE TABLE statement is rich and sometimes confusing. This tech-recipe with an example describes the basics of creating a table in MySQL.

Category MySQL

Posted December 12, 2011 by

Oracle: Using the AFTER INSERT and AFTER UPDATE triggers

A database trigger is a stored procedure that automatically executes whenever an event occurs. The event may be insert-delete-update operations. Oracle initiates an ‘AFTER INSERT’ trigger after an insert event has been occurred and an ‘AFTER UPDATE’ trigger after an update event has been occurred.

Category Oracle

Posted December 7, 2011 by

Oracle: How to Create a Copy of Table Data

Knowing how to copy existing table data is beneficial to any DBA. This tutorial will demonstrate how to copy an existing table’s data into a new table. Examples with walkthrough explanation are provided.

Category Oracle

Posted December 5, 2011 by

Oracle: How to Create an Auto Increment Field Using Sequence

In Oracle, you can create an auto increment field using ‘sequence’ database object that can be assigned as primary keys. Using Oracle ‘sequence’ object, you can generate new values for a column. An Oracle sequence is an object like a table or a stored procedure. Examples with walkthrough explanations are provided.

Category Oracle

Posted November 4, 2011 by

SQL Server 2008/2008 R2: Move tempdb to Improve Performance

By default, tempdb is placed on the same drive that SQL Server is installed on. This can impair performance as tempdb is frequently used to store temporary tables and objects. If the hard drive is being accessed for other functions, it can result in sluggish performance by the database as well as any software that [...]

Category Database