Saturday, August 27, 2011

SQl Select.

Learn how to use the SELECT statement to pull data from a SQL database table.


The SQL SELECT statement is used to select data from a SQL database table.This Command is the most frequently used command because every sql command retrieving data from a SQl database will  use this command.

SQL SELECT syntax: 

SELECT Column1, Column2, Column3,
FROM Table1

The list of column names after the SQL SELECT command determines which columns you want to be returned in your result set. If you want to select all columns from a database table, you can use the following SQL statement in which we replace column names with "*" symbol which select all the columns from the table.

SELECT *
FROM Table1

 it is always better to explicitly specify the columns in the SELECT list, as this will improve your query performance significantly. 

The table name following  "from" will determine which table to be used to retrieve data .


MORE BASIC SQL COMMANDS

SQL in a Nutt Shell. Learn what SQL (Structured Query Language) is, and how it is used when required.


The foundation of every Relational Database Management System is a database object called table. Every database consists of one or more tables, which store the database’s data/information. Each table has its own unique name and consists of columns and rows. 

The database table columns (called also table fields) have their own unique names and have a pre-defined data types. Table columns can have various attributes defining the column functionality (the column is a primary key, there is an index defined on the column, the column has certain default value, etc.).
While table columns describe the data types, the table rows contain the actual data for the columns.

Here is an example of a simple database table, containing Company data. The first row, listed in bold, contains the names of the table columns:
SQL Database Tables are the foundation of every RDBMS (Relational Database Management System).
Here is an example of a simple database table, containing Company data. The first row, listed in bold, contains the names of the table columns:

Table: Company
FirstName
LastName
Email
DOB
Phone
Scott
Armstrong
Armstrong.yahoo.com
2/4/1968
887-676-2321
Adam
Red
red@himail.com
4/4/1978
792 343-2422
Santo
Harry
Harry@livingin.org
5/24/1978
416 323-3232
Jackson
Jimmy
Jimmy@supermail.co.uk
20/10/1980
416 323-8888

 Now that we’ve learned what is a database table, we can continue with our sql tutorial and learn how to manipulate the data within the database tables. 

I will be posting different basic sql commands which are widely used following this post. 

MORE BASIC SQL COMMANDS

Getting Started With Transact SQL.


Getting Started With SQL Server.

This video provides three examples of how to get started with SQL Server

Monday, August 22, 2011

Video Installing Sql Server 2008


Installing Microsoft SQl Server

Installing the Server of Microsoft SQL Server
As we will see in the next lesson(s), there are various ways you use, or connect to, Microsoft SQL Server. For this reason, there are also various ways to install it. The primary type consists of installing Microsoft SQL Server on only one computer you will use to do everything. That machine may not be connected to another or you will not be concerned with using things (files or databases) in other computers. With this type of setup, you perform the installation on that computer and simply start using Microsoft SQL Server.

Practical Learning: Installing Microsoft SQL Server
  1. Start the computer
  2. Log in using an account with administrative rights. If you followed the previous lesson, log in using the phkatts account. If the computer you are using is connected to a network, make sure you specify the domain. If you are logged in locally, make sure you use the name of the computer.
    If you are installing in Microsoft Windows XP-7, make sure you log in with a password, otherwise the installation will fail.
    For our installation, we will log in as Administrator (in either Microsoft Windows 7 Professional/Ultimate or in a domain named functionx.local)
  3. Insert the DVD in the drive. You may (should) receive a dialog box with a Run SETUP.EXE link:

    AutoPlay

    If so, click Run SETUP.EXE
  4. The installation will start. You may get a message that the .NET Framework needs to be installed. If you get that message, click OK. You will be prompted to start the installation:
    Microsoft .NET Framework 3.5 SP1 Setup
    After clicking the ACCEPT button, you can click Install. The installation of the .NET Framework would start. When the installation of the .NET Framework is over, you would receive a message:
    .NET Framework
    From there, you can click Exit. If you are installing in either Microsoft Windows XP or Microsoft Windows Server 2003, you may be asked to install a hotfix:
    Hotfix
    Hotfix
    In this case, accept to install it by clicking Next and following the wizard. When the installation is over, you may be asked to restart:
    Hotfix
    Which you should do.
  5. To start the installation, put the Microsoft SQL Server 2008 DVD in the drive. A window would come up:

    Installation
  6. In the left section, click Installation

    Installation
  7. If you are only interested in studying database design and development in Microsoft SQL Server, on the right side, click New SQL Server Stand-Alone... The installation would start:

    Installation
  8. After the message box, click OK

    Setup
  9. Another message box would come up. When it finishes, the next page of the wizard would come up. If you are using the evaluation version, read the message and click the first radio button

    Product Key

    If you are installing with a product key, click the second radio button and enter the key

    Product Key
  10. Click Next
  11. The License Terms page is presented to you. Read it. If you don't agree with the license, click Cancel. Otherwise, click the I Accept check box:

    License Agreement

    License Agreement
  12.  Click Next

    Microsoft SQL Server 2008 Setup
  13. Read the messages and click Install:

    Microsoft SQL Server 2008 Setup
  14. You may receive a warning message about the firewall:

    Firewall warning

    For now, ignore it (there is no true justfication in trying to disable the firewall, the installation will proceed fine).
    If you are installing on the only computer you use as your server, you may receive a warning that it is not recommended to install Microsoft SQL Server on a domain controller:

    Domain Controller Warning

    Ignore the warning for now.
    Click Next
    (We are not encouraging you to ignore warnings; just these ones)
  15. If you had previously installed Microsoft SQL Server Express, you may receive a message box asking you to specify an instance name. If so, specify it as MSSQLSERVER.
    The next page allows you to specify what you want to install and what would be left out. For our example, we select all, then removed Reporting Services.

    The eventual location of Microsoft SQL Server is specified in the bottom text box:

    Feature Selection

    If you are installing the Developer Edition and if you to change the directory of Microsoft SQL Server, you can type it in the Shared Feature Directory text box, or you can click the browse button to select it.

    Feature Selection

    If you are installing the Enterprise Edition, if you to change the directory of Microsoft SQL Server, click the broser button on the right side of the Shared Feature Directory text box and locate the directory you want.

    After making your selections, click Next
  16. The next page allows you to name the instance of Microsoft SQL Server (and to specify where the server would be installed). In most cases, you should accept the suggested name of the instance as MSSQLSERVER:

    Instance

    After making your selections, click Next
  17. The next page mostly allows you to check and confirm the disk space:

    Disk Space

    After checking it, click Next
  18. The next page allows you to specify the account that is performing the installation:

    Server Configuration

    Click Use the Same Account For All Server Services
  19. A dialog box would come up.
    If you are installing in Microsoft Windows 7 and you want to use a local account, in the Account Name text box, enter the name of the computer, followed by a back slash, followed by the user name, and press Tab. In the Password text box, enter the password:

    Log In

    If you are installing in Microsoft Windows Server 2008, in the Account Name text box, enter the name of the domain, followed by a back slash, followed by the user name, and press Tab. In the Password text box, enter the password:

    Log In
  20. Click OK

    Log In

    Log In
  21. Click Next
  22. After making your selections, click Next
  23. In the next page, specify how authentication would be made. You should also specify the account used as the administrator. To do this, you can click Add Current User:

    Database Engine Configuration
  24. Microsoft SQL Server provides a default user named sa. To prepare that user for database authentication, click the Mixed Mode
  25. Type a password in the Enter Password text box. For this exercise, you can use P@assword1 anad press Tab
  26. Enter the same password in the Confirm Password text box
  27. To add an additional account, click Add...
    A dialog box would display. In the bottom text box, type the (complete) user name of a user and click Check Names. In the same way, you can add as many users as possible

    Database Engine Configuration
  28. Click Next
  29. The next step allows you to specify an account for the analysis services. Click Add Current User

    Analysis Services Configuration

    To add an additional account, click Add... In the bottom text box, type the (complete) user name of a user and click Check Names. In the same way, you can add as many users as possible

    Analysis Services Configuration
  30. Click Next
  31. In the Reporting Services Configuration page, click the last radio button to install but without configuring the reporting:

    Reporting Services Configuration
  32. Click Next.
    The next page allows you to specify whether you want and installation report to be sent to Microsoft:

    Error and Usage Reporting
  33. Read it and click Next
  34. The next page gives you a summary of tests that were performed before the installation:

    Installation Rules
  35. After reading, click Next.
    This would indicate that the installation is ready to proceed:

    Ready to Install
  36. To start the installation, click Install. The installation would start and a progress bar would indicate the evolution. This can take a while

    Installation Progress

    Installation Progress
  37. When this phase is over, a message box will let you know. After reading it, you can click Next. The last page of the wizard should announce that the installation was complete

    Installation
  38. After reading the message, click Close