Loading

SQL

  • Language: 

    In this tutorial I will teach you on how to enable remote connection on SQL Server. I will use SQL Server 2005 Express Edition on this tutorial. However, this is also applicable to any version of SQL Server. The only difference is the GUI for different kinds of SQL Server version.

    This tutorial is very useful if you want to access your SQL Server database from other computer and you want to connect two or more computers from your network.

  • Language: 

    If you are working with SQL Server Management Studio Tools and encounter the following error when modifying one of your tables:

    “Saving changes is not permitted. The changes you have made require the following tables to be dropped and re-created. You have either made changes to a table that can't be re-created or enabled the option Prevent saving changes that require the table to be re-created.”

    All you have to do is unchecked the “Prevent saving changes that require the table to be re-created” under the tools menu.

    Follow the screenshot below to disable it.

  • Language: 

    The DROP statement is used to delete object in SQL, with the DROP statement we can remove index, tables and even databases easily.

    DROP INDEX

    The indexes of the table can be dropped by the using the following command.

    SYNTAX for MS Access

  • Language: 

    The MID() function is used to extract values from a column. The MID() contain three (3) parameters. The first one is used to select which column to extract, the second one is the starting position, the last one is the number of characters to be extracted.

    SQL MID() Syntax

    SELECT MID(column_name,start[,length]) FROM table_name

    Consider the following table for this exercise

    Users

  • Language: 

    The AVG function calculates the average of a specified column. It works only on a numeric column. It first sums up all data and then divides it by the total number of rows.For example if the sum of 5 items is 10 then average is 10/5 = 2.

    SQL AVG() Syntax

    SELECT AVG(column_name) FROM Table

    Consider the following table for this exercise

    Users

  • Language: 

    The FIRST function returns the first value of the selected column. FIRST function is not standard SQL function so it cannot be used with other DBMS like MySQL. However this is very useful with MS Access OR SQL Server.

    SQL FIRST() Syntax

    SELECT FIRST(column_name) FROM Table

    Consider the following table for this exercise

    Users

  • Language: 

    The MAX function is use to return the largest value of the selected column. MAX can be use only in numeric column.

    As with other function, you can also give an Alias to the MAX function.

    SQL MIN() Syntax

    SELECT Max(column_name) FROM Table

    Consider the following table for this exercise

    Users

  • Language: 

    The MIN function is use to return the smallest value of the selected column. MIN can be use only in numeric column.

    As with other function, you can also give an Alias to the MIN function.

    SQL MIN() Syntax

    SELECT Min(column_name) FROM Table

    Consider the following table for this exercise

    Users

  • Language: 

    The SUM function is an aggregate function use to calculate the total amount of a column. SUM function can be use only in numeric column.

    Syntax

    SELECT SUM(column_name) FROM Table

    Consider the following table for this exercise

    Users

  • Language: 

    The NOW() function is an aggregate function used to return the date and time along with other column.

    The NOW() function returns the result as dd/mm/yyyy HH:MM:SS AM/PM depending on your regional settings.

    SQL NOW() Syntax

     SELECT column_name(s),NOW() FROM Table

    Consider the following table for this exercise

    Users

Pages