# Use SQL to create database structures and manipulate data

Web Design → Use SQL to create database structures and manipulate data
This page is part of the Web Design project. :
From the official document ICAB4136A:
    "This unit defines the competency required to use a structured query language (SQL) to define, create and manipulate database structures and associated data in a relational database."
Basically, that means ... (translate above into plain english)
You can read more about this unit on the National Training Information Systems Official document for ICAB4136A.
This unit forms part of the following qualifications:

## How this unit will help you

After learning and applying the skills required by this unit you'll be able to demonstrate your skills in:
| ELEMENT | PERFORMANCE CRITERIA |
| 1. Write a simple SQL statement to retrieve and sort data | Retrieve all the data from a single table Retrieve data from specific columns in a single table Use 'order by' to sort query output |
| 2. Write an SQL statement that selectively retrieves data | Restrict the number of rows retrieved by placing criteria in the 'where' clause Restrict the number of rows retrieved by placing specific criteria in the select statement Use comparison operators in the 'where' clause to compare numeric, character, string, date and time data Use Boolean operators with the correct precedence Use criteria in the 'where' clause to check for a range of values, to select values from a list, and to check for values that match a pattern Use SQL syntax to suppress duplicate values from query results Take action to exclude null values from a query result |
| 3. Write SQL statements that use functions | Use arithmetical operators with the correct precedence Use string functions and operators to obtain the required query output Use mathematical functions to obtain the required output, where required Use date functions to obtain the required output Use SQL aggregate functions to obtain the required output |
| 4. Write SQL statements that use aggregation and filtering | Use 'group by' to aggregate data by multiple columns Sort aggregated data in the query output Filter aggregated data using the 'having' clause |
| 5. Write SQL statements that retrieve data from multiple tables | Employ the inner join syntax to retrieve data from two or more tables Use 'left outer', 'right outer' and 'full outer' syntax to join tables in the select statement Use correct syntax in the 'where' clause to retrieve data from multiple tables Write a union query that retrieves data from more than one table |
| 6. Write and execute SQL sub queries | Construct single and nested sub-queries Construct sub-queries that return a single row, and multiple rows Use correlated sub-queries to retrieve required data Write sub-queries that use aggregates |
| 7. Create and manipulate tables | Identify required columns, data types, keys, relationships, indexes and constraints Use relevant naming conventions for all database elements Create tables that implement all required elements Insert rows into tables Update some or all of the data in a table Add columns to a table Modify a column within a table Delete a column from a table Delete rows from a table 0View detailed information regarding a table 1Delete tables with regard to referential integrity rules |
| 8. Create and use views | Create views that satisfy information requirements Use check constraints in a view Retrieve, insert, update and delete data using a view Drop a view from a database |
| 9. Create and use stored procedures | Create and execute stored procedures that use SQL to retrieve, insert or modify data according to information requirements Create and execute stored procedures that use one or more parameters Drop a stored procedure from the database Create and test database triggers that automate data management or perform specific required data-related functions |
* translate the above elements and performance criteria into plain English and summaries here...
To find the 2nd max salary from your table -

## Ideas for demonstrating this unit

The best way to demonstrate these skills is ...

## Grading

If you are demonstrating this unit as part of a formal course, you might find that the unit is graded (meaning you can not only demonstrate your competence, but can also gain a credit or distinction). Your facilitator may already have set criteria that your college uses. If not, here are some ideas for possible credit/distinction activities that you can discuss with your facilitator: