Geschreven door studenten die geslaagd zijn Direct beschikbaar na je betaling Online lezen of als PDF Verkeerd document? Gratis ruilen 4,6 TrustPilot
logo-home
Tentamen (uitwerkingen)

inf3707_summary notes

Beoordeling
-
Verkocht
-
Pagina's
111
Cijfer
A+
Geüpload op
06-11-2021
Geschreven in
2021/2022

INF3707 - Database Design & Implementation Summary 2014 Ref. Lesson Title Page 1. 1-L1 Retrieving data using the SQL select statement 2 2. 1-L2 Restricting and sorting data 7 3. 1-L3 Using single row functions to customize output 15 4. 1-L4 Reporting aggregated data using the group functions 25 5. 1-L5 Displaying data from multiple tables 30 6. 1-L6 Using sub-queries to solve queries 37 7. 1-L7 Using the set operators 42 8. 1-L8 Manipulating data 46 9. 1-L9 Using DDL statements to create and manage tables 54 10. 1-L10 Creating other schema objects 62 11. 1-L11 Managing objects with data dictionary 69 12. 2-L1 Controlling user access 73 13. 2-L2 Managing schema objects 79 14. 2-L3 Manipulating large data sets 86 15. 2-L4 Generating reports by grouping data 92 16. 2-L5 Managing data in different time zones 98 17. 2-L6 Retrieving data using sub-queries 101 18. 2-L7 Hierarchical retrieval 107 19. 2-L8 Regular expression support 108 Oracle 10g - Introduction to SQL (Part 1 & 2) Ver 1.00 - April 2014 Ron Barnard 1-L1 - Retrieving data using the SQL SELECT statement Retrieving data using the SQL select statement Objectives • List the capabilities of SQL SELECT statements • Execute a basic SELECT statement • Differentiate between SQL statements and iSQL*Plus commands Content Selecting All Columns You can display all columns of data in a table by using an asterisk * after the SELECT keyword. SELECT * FROM departments; You can also display all columns in a table by listing all the columns after the SELECT keyword. SELECT department_id, department_name, manager_id, location_id FROM departments; Selecting Specific Columns You can use the SELECT statement to display specific columns of a table by specifying the column names, separated by commas. Specify the columns that you want, in the order that you want them to appear in the output. SELECT department_id, location_id FROM departments; Writing SQL Statements • SQL statements are not case-sensitive (unless indicated). • SQL statements can be entered on one or many lines. • Keywords cannot be split across lines or abbreviated. • Clauses are usually placed on separate lines for readability and ease of editing. • Indents should be used to make code more readable. • Keywords typically are entered in uppercase; all other words, such as table names and columns, are entered in lowercase. • Each SQL statement should be ended with a semi-colon. Column Heading Defaults • Character and Date column headings are left aligned. • Number column headings are right-aligned. • Default heading display: Uppercase • Can override the column heading display with an Alias. Page 2 of 111 1-L1 - Retrieving data using the SQL SELECT statement Arithmetic Expressions You may need to modify the way in which number and date data are displayed, or you may want to perform calculations or look at what-if scenarios. These are all possible using arithmetic expressions. An arithmetic expression can contain column names, constant numeric values, and the arithmetic operators. Available arithmetic operators - + Add, - Subtract, * Multiply, / Divide. You can use arithmetic operators in any clause of an SQL statement, except the FROM clause. DATE and TIMESTAMP data types can only use the ADD and SUBTRACT operators. Using Arithmetic Operators SELECT last_name, salary, salary + 300 FROM employees; The output also displays a "SALARY + 300" column. The calculated column is NOT a new column in the EMPLOYEES table, it is for display only. Blank spaces before and after the arithmetic operator are ignored. Operator Precedence • Multiplication and division are evaluated before addition and subtraction. • Operators of the same priority are evaluated from left to right. • Parentheses are used to override the default precedence or to clarify the statement Null Values If a row lacks a data value for a particular column, that value is said to be null or to contain a null. A null is a value that is unavailable, unassigned, unknown, or inapplicable. A null is not the same as a zero or a space. Zero is a number, and a space is a character. Columns of any data type can contain nulls. However, some constraints (NOT NULL and PRIMARY KEY) prevent nulls from being used in the column. Null Values in Arithmetic Expressions If any column value in an arithmetic expression is null, the result is null. For example, if you attempt to perform division by zero, you get an error. However, if you divide a number by null, the result is a null or unknown. Defining a Column Alias A column Alias - • Renames a column heading; • Is useful with calculations; • Immediately follows the column name. (There can also be the optional AS keyword between the column name and alias.) • Requires double quotation marks if it contains spaces or special characters, or if it is case sensitive. • Uppercase by default. Page 3 of 111 1-L1 - Retrieving data using the SQL SELECT statement Concatenation Operator A concatenation operator - • Links columns or character strings to other columns; • Is represented by two vertical bars (||); • Creates a resultant column that is a character expression. SELECT last_name || job_id AS "Employees" FROM employees; You can link columns to other columns, arithmetic expressions, or constant values to create a character expression by using the concatenation operator (||). Columns on either side of the operator are combined to make a single output column. If you concatenate a null value with a character string, the result is a character string. LAST_NAME || NULL results in LAST_NAME. Literal Character Strings • A literal is a character, a number, or a date that is included in the SELECT statement, and that is not a column name or a column alias. • Literal strings of free-format text can be included in the query result, and are treated the same as a column in the SELECT list. • Date and character literal values must be enclosed by single quotation marks, number literals need not be enclosed. • Each character string is output once for each row returned. SELECT last_name || ' is a ' || job_id AS "Employee Details" FROM employees; Alternative Quote (q) Operator Many SQL statements use character literals in expressions or conditions. If the literal itself contains a single quotation mark, you can use the quote (q) operator and choose your own quotation mark delimiter. You can choose any convenient delimiter, single-byte or multibyte, or any of the following character pairs - [ ], { }, ( ), or . SELECT department_name || q' [, it's assigned Manager Id: ] ' || manager_id AS "Department and Manager" FROM departments; Duplicate Rows The default display of queries is all rows, including duplicate rows. To eliminate duplicate rows in the result, include the DISTINCT keyword in the SELECT clause immediately

Meer zien Lees minder
Instelling
University Of South Africa
Vak
INF3707 - Database Design And Implementation











Oeps! We kunnen je document nu niet laden. Probeer het nog eens of neem contact op met support.

Geschreven voor

Instelling
University of South Africa
Vak
INF3707 - Database Design And Implementation

Documentinformatie

Geüpload op
6 november 2021
Aantal pagina's
111
Geschreven in
2021/2022
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden

Onderwerpen

$3.99
Krijg toegang tot het volledige document:

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF

Maak kennis met de verkoper

Seller avatar
De reputatie van een verkoper is gebaseerd op het aantal documenten dat iemand tegen betaling verkocht heeft en de beoordelingen die voor die items ontvangen zijn. Er zijn drie niveau’s te onderscheiden: brons, zilver en goud. Hoe beter de reputatie, hoe meer de kwaliteit van zijn of haar werk te vertrouwen is.
ExellentStudyResources Chamberlain College Of Nursing
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
1098
Lid sinds
4 jaar
Aantal volgers
917
Documenten
2076
Laatst verkocht
2 weken geleden

3.6

149 beoordelingen

5
67
4
19
3
31
2
4
1
28

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Bezig met je bronvermelding?

Maak nauwkeurige citaten in APA, MLA en Harvard met onze gratis bronnengenerator.

Bezig met je bronvermelding?

Veelgestelde vragen