Data Analysis

 

Overview of Data Analysis

 

Introduction

After creating a table and filling it up with some values, the next step is probably to see what you can do with data stored in it. One of the most commonly performed operations by the users of a database is to look for data or to isolate data that responds to a particular criterion. Looking for data that is conform to  a criterion is referred to as querying.

As a database developer, you perform queries by passing instructions to the SQL interpreter. This is done using some special reserved words.

Practical LearningPractical Learning: Introducing Data Analysis

  1. Open the MySQL prompt
  2. Execute the following statement:
     
    USE ROSH1;

Column Selection

As we learned in previous lessons, the most fundamental keyword used by SQL is SELECT. In order to process a request, you must specify what to select. Therefore, the SELECT keyword uses the following syntax:

SELECT What FROM WhatObject;
As stated already, SQL is not case-sensitive. This means that SELECT, Select, and select represent the same word.

The What factor of our syntax is the name of the column(s) of a table. The WhatObject factor can be the name of a table (or a view).

Practical LearningPractical Learning: Performing Data Analysis

  1. To select everything from a table, you can use the asterisk as the range of values. For example, to display all records, execute the following statement:

    SELECT * FROM Students;
  2. As opposed to viewing all data, you can also select one particular column whose fields you want to view. To do this, you can replace the What factor in the syntax with the name of the desired column. As an example, execute the following statement:

    SELECT LastName FROM Students;

    When you execute the statement, it would display only the column that contains the last names

  3. To consider more than one column in a statement, you can list them in the What factor of our syntax, separating them with a comma except for the last column. The syntax you would use is:

    SELECT Column1, Column2, Column_n FROM WhatObject;

    As an example, to display a list that includes only the names, gender, and home phone of records from a table called Students, execute the following statement:

    SELECT FirstName, LastName, Gender, HomePhone
    FROM Students

 


Previous Copyright © 2004-2012, FunctionX Next