What Is PL/SQL?

What Is PL/SQL?

Oracle SQL Tutorial: Get Started Quickly https://www.udemy.com/blog/oraclesql‐tutorial/ This Oracle/SQL tutorial offers a quick way to learn how to use SQL to interact with an Oracle database. Newcomers to programming often consider learning a new programming language to be a difficult process. The best way to learn a new language is to start with the basics and then move to more advanced topics. If you’re interested in demystifying the concepts relating to programming, an introductory course designed to teach non‐programmers the basics is a good place to start. Let’s get started! What is the Relationship Between Oracle and SQL? To understand Oracle SQL, you first need to understand SQL. SQL is an acronym that stands for Structured Query Language, which is a type of programming language. Like all programming languages, SQL has two distinct characteristics: (1) it is comprised of a set of instructions and (2) it is used to solve problems. The instructions you write in SQL are called statements. Programming languages such as C++ and Java are considered general purposes languages because they can solve a variety of different problems. SQL is designed to focus on one— managing data that is stored in a relational database management system or RDMS. There are numerous flavors of SQL that differ in how they implement the programming language. The list includes DB2, MS SQL Server, MySQL, PostgreSQL, Informix, and of course Oracle. Oracle was the first of these implementations to be offered for commercial purposes (it was initially sold to government agencies). Today, Oracle SQL is considered the standard implementation for interacting with RDBMS. Oracle 11g is the most recent version of Oracle that was released in 2007. Once you learn the basics in this tutorial, you can then extend your skills to include database administration. A comprehensive course in Oracle 11g, which includes the basics for administering an Oracle 11g database, is an excellent choice. Key Concepts Before jumping into using the Oracle implementation of SQL, there are some important concepts you should understand because you will undoubtedly come across them when using the language. These concepts are common to other query languages, but some have specific uses in Oracle. Database – A collection of data that is organized in a specific order. Table – An object that stores data or information in columns and rows organized in a database. Datatype – The kind of data stored in a table or column. Oracle includes the following basic datatypes: char, varchar, number, date, and long. Schema – The structure of an entire database (tables and fields), and how they relate to one another. Command/Query – An operation that you perform on a database. The most basic operations you can perform on an Oracle database include the following: SELECT – Retrieve data CREATE – Create a table INSERT – Add data UPDATE – Replace a row value with the value identified in the SQL expression DELETE – Remove rows from a table DROP – Remove a table Query Statement – A series of elements that are executed against a database to perform a specific command. If you’re interested in learning more about these concepts, you could do so in under a week by taking a quick course in SQL. Querying an Oracle Database with SQL Learning a new programming language is a lot like learning a new spoken language. You first have to learn the rules of the language. In programming terms, the rules are called syntax. It’s important that you follow the rules to prevent errors during processing. The most common SQL command is to query a database for specific data. You use the SELECT statement to do this: SELECT * FROM Customers; This is what you need to know about this statement: SELECT is the operation that instructs SQL that we want to extract data from the database. The asterisk is a shortcut for referring to all columns in the table. If you want to query a single column, you would use the name of the column instead of an asterisk. FROM Customers indicates where SQL should get the data. The semicolon at the end of the statement signals SQL the conclusion of the statement. SQL reserved words such as SELECT and FROM are not case sensitive, but common practice is to use all capital letters for readability. SQL commands have specific purposes, but they have a similar structure. Here are more examples: Example Query 1: CREATE CREATE TABLE Movies ( MovieID int, Title varchar(255) Genre varchar(255) Rating varchar(255) ); This is what you need to know about this query: CREATE TABLE Movies is the operation that indicates the name of the new table we want created. The information between the open and close parentheses identifies the columns in the new table and their datatypes. Example Query 2: INSERT INSERT INTO Movies (MovieID, Title, Genre, Rating) VALUES (‘0001’, ‘Matrix Reloaded’, ‘Science Fiction’, ‘PG’); This is what you need to know about this query: INSERT INTO Movies (MovieID, Title, Genre, Rating) is the operation that informs SQL of the data we want to add. The data in the first set of parentheses indicate the columns we want to populate. VALUES (‘0001’, ‘Matrix Reloaded’, ‘Science Fiction’, ‘PG’) indicates the list of values we want for each column. Example Query 3: UPDATE UPDATE Orders SET CustomerName= ‘Jane Done’ WHERE CustomerName= ‘John Doe’; This is what you need to know about this query: UPDATE Orders is the operation that instructs SQL which table we want to update. SET CustomerName= ‘Jane Doe’ indicates the updated data WHERE CustomerName= ‘John Doe’ indicates the data we want to update. Example Query 4: DELETE DELETE FROM Contractors WHERE ContractorName= ‘Smith Contracting, Inc.’; This is what you need to know about this query: DELETE FROM Contractors is the operation that indicates where we want to make a deletion. WHERE ContractorName= ‘Smith Contracting, Inc.’ indicates the data we want to delete. Example Query 5: DROP DROP TABLE Movies; This is what you need to know about this query: DROP TABLE Movies is the operation that indicates which table we want to delete. These are just the basics of using SQL with an Oracle RDBMS. The query language includes other elements that extend basic SQL functions. You are now ready to put your knowledge to work and take a course that teaches the basics of developing a local database. PHP For Loop: A Lesson in Repetition https://www.udemy.com/blog/php‐for‐loop/ PHP: Hypertext Preprocessor (PHP) is a server‐side scripting language that is interpreted by a web server, and then optionally displayed in HTML. It basically runs as a program inside of a website. PHP programs do not compile the same as general purpose programming languages, but use similar logic, such as loops that change program logic. Adding Loops to Your PHP Programs Computer programs rarely contain statements that run on a continuous path from beginning to end. The more common scenario is that the program makes stops along the path to evaluate conditions and execute statements according to those conditions. PHP supports four types of loop statements: for – Repeat for a specific number of times while – Repeat until the condition is true do…while – Same as While, but executes at least once foreach – Repeat elements in an array For this tutorial the concentration is the for loop. If the PHP language is new to you, you may want to consider learning PHP from scratch first to grasp the basics of the language. The for loop syntax looks like this: for (declaration; condition; action) { Statement to execute; } As you can see, there are two basic steps for creating a for loop in PHP: 1. Start the loop with the for keyword followed by three parameters (declaration, condition, and action) enclosed in parentheses: Declaration – Expression that declares the variable that you want to loop and its starting value. Add a semicolon at the end of the expression. Condition – Expression that sets the condition that you want to use to test against the variable. The loop will continue until this condition is no longer true. Add a semicolon at the end of the expression. Action – Expression that specifies how the value of the variable is updated. You can use the increment operator (++) to increase the value or the decrement operator (‐ ‐) to decrease the value. This expression is written with the operator immediately following the variable, no spaces. 2. Next, you add the statement that you want to execute, enclosed in curly brackets. Example 1: Simple Loop This example uses the classic “Hello world!” program to demonstrate how a PHP for loop works. <?php for ($num=1; $num<=5; $num++) { echo “ Hello world!””<br/>; } ?> In English language terms, this block of code states to start a variable called num at 1, continue the loop as long as the value of num is less than or equal to 5, and at the end of each loop increase the value of num by one. For each loop print “Hello world!” on the screen. Here’s the output: Hello world! Hello world! Hello world! Hello world! Hello world! For each loop there is an output of “Hello world!” to the screen. Example 2: Nested for Loops The snippet of code in example 1 contains a single for loop. You can also create nested loops of two or more for loops that add more complexity to your code. This example contains two for loops to create a mathematical table you might recognize from your childhood. You can learn more interesting techniques in a PHP for beginners course. <?php echo “<table>”; for ($x=1; $num<=10; $x++) { echo “<tr>; for ($y=1; $y<=10; $y++) { echo “<td>”; echo $x*$y; echo “</td>”; } echo “</tr>”; } echo “</table>”; ?> Here’s the output: 1 2 3 4 5 6 7 8 9 10 2 4 6 8 10 12 14 16 18 20 3 6 9 12 15 18 21 24 27 30 4 8 12 16 20 24 28 32 36 40 5 10 15 20 25 30 35 40 45 50 6 12 18 24 30 36 42 48 54 60 7 14 21 28 35 42 49 56 63 70 8 16 24 32 40 48 56 64 72 80 9 18 27 36 45 54 63 72 81 90 10 20 30 40 50 60 70 80 90 100 You might recognize the output as a multiplication table.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    27 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us