SQL Reference

SQL limit returned rows in mysql, sqlserver and oracle

The following compares the syntax needed to limit the number of rows returned in each Mysql, MSsql and Oracle.

MySQL Creating new user for a database via command line client

The following sums how to create a new database and give a user appropriate rights via the mysql command line client:

MSSQL charindex in where clause

You can use the CHARINDEX function in a where clause much as you would use the LIKE keyword in a query. For more discussion see:

http://bytes.com/topic/sql-server/answers/81467-using-charindex-vs-like-where

MSSQL running queries on sql server 2000 via sql server 2008

When you run into errors running queries after adding a linked server which runs sql server 2000 on a machine running sql server 2008 try the openquery function instead :

MySQL Enable remote access on MySQL

For instance when accessing a server using MySQL Query Browser you need to enable remote access, or you'll receive errors 1130 or 2003.

MySQL Restart MySQL

to restart mysql on Debian / Ubuntu:

MSSQL Conditional where statement

Conditionally placed where statement (in stored procedure)

MSSQL Getdate()

Returns the current database system timestamp as a datetime value, derived from the operating system of the computer on which the instance of SQL Server is running

MSSQL Table information

This stored procedure will give you extensive information about the fields in a table

MySQL Retrieving table information

assuming the table is named  pet

SQL Altering excisting table

Add a field :

MySQL MySQL last insert id

In MySQL you can retrieve the value of the last auto increment field upped by an insert using the LAST_INSERT_ID() function. Example:

SQL Copy query

This query duplicates the rows inside a table:

[x]