Sql Statement Snippets


28 June, 2014   

Starting in Oracle 9i, you can use the case statement within an SQL statement. It has the functionality of an IF-THEN-ELSE statement.

05 May, 2012   

ASP code example with Sql Statement

02 January, 2012   

The UPDATE statement is used to update existing records in a table

04 January, 2012   

SQL example Code for SELECT statement with HAVING clause

16 February, 2013   

Binds a php variable to an SQL statement using the bindParam() method

15 June, 2014   

Example for updating a record in a database with perl and the DBU module.

01 December, 2011   

The following code block shows how to run DML statements in PL/SQL. Basically they look similar to the SQL. Note that the SELECT statement retrieves the single-row value and store into a variable using INTO clause.

A simple DELETE statement in MSSQL

27 May, 2014   

PL/SQL Code for a searched CASE statement

09 May, 2011   

This is a general code to use when selecting an item from a MySQL database. This code isn't considered definitive and can be written in many varied ways. Note: This code requires you to connect to the MySQL database to work. Also, all field and table names need to be set up to match. This MYSQL Code using in PHP

14 May, 2011   

This is a general code to use when updating an item from a MySQL database. This code isn't considered definitive and can be written in many varied ways. Note: This code requires you to connect to the MySQL database to work. Also, all field and table names need to be set up to match.

A simple INSERT statement in MSSQL with the various types of values.

14 May, 2011   

This is a general code to use when deleting an item from a MySQL database. This code isn't considered definitive and can be written in many varied ways. A variation of the code would be not to delete the record (as you tend to always need to restore or retrieve it sooner or later) you can add a 'status' field. If status='d' then it is...

17 December, 2011   

In a table, some of the columns may contain duplicate values. Sometimes you will need to list only the different (distinct) values in a table. The DISTINCT keyword can be used to return only distinct (different) values.

This sql statement enables to detect duplicates entries over a key and creates a seq column which says which one is the sequence of the duplicates. This way you can take only the seq = 1 and still be able to identify all duplicates

21 January, 2012   

PL/SQL Block that uses implicit cursor attributes as below example code.

09 May, 2011   

This is a general code to use when inserting an item from a MySQL database. This code isn't considered definitive and can be written in many varied ways. An extention of this code would be to make sure the entry you are adding to the database doesn't already exist (to save dupicate entries). Note: This code requires you to connect to the MySQL...

24 June, 2015   

Create a table with the results from a SELECT statement.

05 May, 2012   

ASP code example to return a long representing the record count returned by an SQL statement

07 September, 2014   

The "WITH CHECK OPTION" is used to indicate that Oracle will prevent any changes to the table or view that would produce rows that are not included in the subquery. When used in the subquery of a DML statement, you can specify this clause in a subquery in the FROM clause but not in subquery in the WHERE clause.