SQL Tutorial
SQL Database
SQL Table
SQL Select
SQL Order By
SQL Insert
SQL Update
SQL Delete
Difference
SQL Injection
SQL String Functions
Miscl
- SQL Formatter
- SQL group by
- SQL add/drop/update column operation
- SQL CAST Function
- SQL Comments
- SQL CONCAT Function
- CTE (Common Table Expression)SQL
- How to use distinct in SQL?
- Joining Three or More Tables in SQL
- What is Web SQL?
- How to create functions in SQL?
- How to run SQL Script?
- How to Delete Duplicate Rows in SQL?
- Nth Highest salary
- 12 Codd's Rules
- SQL EXCEPT
- Types of SQL JOIN
- Change datatype of column in SQL
- SQL Auto Increment
- SQL Like
- Commit and Rollback in SQL
- SQL Concatenate
- SQL get month from the date
- Savepoint in SQL
- SQL ORDER BY DATE
- TIME Datatype in SQL
- SQL BETWEEN
- CRUD Operations in SQL
- SQL INDEX
- Scalar Functions in SQL
- SET Operators in SQL
- Types of SQL Commands
- TCL Commands in SQL
- SQL Subquery
- SQL View
- Constraints in SQL
- Pattern Matching in SQL
- SQL Date Functions
- DDL Commands in SQL
- DML Commands in SQL
- SQL CASE
- SQL Inner Join
- SQL IN Operator
- Check Constraint in SQL
- SQL CLAUSES
- SQL LOGICAL OPERATORS
- Delete Column from Table
- Add Column in the Table
- Delete one row in SQL
- Change the Column Value
- How to Add Foreign Key in SQL
- Add a Primary Key
- Insert One or More rows
- How to Use LIKE in SQL
- Cursor in SQL
- Difference Between DROP and Truncate
- SQL Comparison Operators
- SQL COUNT WHERE
- SQL SELECT MIN
- SQL Stored Procedure
- SQL SELECT AVG
- SQL SELECT MAX
- SQL ADD COLUMN
- How to use Auto-Increment in SQL
- SQL Languages
- SQL Arithmetic Operators
- How to Use GROUP BY in SQL
- How to Use ORDER BY in SQL
- Trigger in SQL
- What is Race Condition
- SQL COUNT DISTINCT
PL/SQL Tutorial
Sql Interview Question
SQl Quiz
How to run SQL Script?
What is SQL Script?
The SQL script is a set of commands that saved as a file in SQL Scripts and it contain one or more SQL statements. We use SQL Scripts to create, run, edit, view or delete the script files.
We must remember the following points while using the SQL Scripts:
- In SQL Scripts, SQL * Plus commands are ignored at the run time.
- There is no any interaction between SQL Scripts and SQL commands in SQL scripts.
- We cut and paste SQL commands from SQL script editor.
- SQL script does not support the bind variables.
Accessing the SQL Scripts
1. First, login to the Workstation.
2. To view the SQL Scripts page, do the following:
- Click on the SQL Workshop icon and drill-out the SQL page.
- Click on the down arrow to the right of the SQL Workshop icon to see the drop-down menu after choosing the SQL Scripts option.
About the SQL Scripts Page
It displays the SQL Scripts that are created by the user. We control the appearance of the page by selecting it from the view list.
The SQL Scripts has three controls:
- Script. It finds the script by entering the partial name or script name in the script field. It displays the rows by selecting from the display list.
- Owner. Find the owner of the script you want to see by going to the owner's name and clicking on the owner's name.
- Opinion. Opinion changes the appearance of SQL Scripts page by selecting the view list.
- Symbol displays every script as an icon that is identified by script name. Click on the Show Results checkbox to show additional results for icons that are determined by the script name.
- Description: The description displays each script in one line. Every line has a checkbox to enable the selection process of script. It allows the script to load script name, script editor, and owner of the script. When the script updated in bytes, the text is linked in the run results, and an icon to enable the script to run.
About the Tasks List
The tasks list is displayed on the right side of the page.
The Task List has these points:
- Task List manages the results and enables the view, search, and display the results.
- Show Quota: The script quota shows the maximum size of result.
- Export enables the SQL repository to import the SQL Scripts in the workspace. The scripts are encoded in a single script and is written in local file system. By default export script is "workspace_name_script / sql".
- Import enables us to import scripts exported by many workspaces.
- The export script accessible on local file system to import.
Use MySQL workbench to run the SQL script.
To open the SQL Script, go to File -> Open
Alternatively, use the shortcut key Ctrl+Shift+O to open the SQL Script.
Import enables the import scripts exported by the workspace or different workspaces. Import only imports the scripts encoded in export scripts created by using export. The export script will accessible on the local file system for importing.
After browsing .sql files, we select the option Reconnect to database, as we have highlighted in the following image.
It asks for a password to connect with MySQL.
After the above process, the SQL files tblstudent appears on the screen that we have uploaded before.
After that, we execute the script by clicking on the symbol highlighted in the following image.
After that, we get the following output:
Deleting Script in the Script Editor
To delete the script, follow the steps given below:
- First, click on SQL Workshop and then SQL Scripts on the Workspace home page. The SQL Scripts page appears in the screen.
- Open the script which we want to delete in the Script Editor.
- Click on the Delete button to remove the script from the Script Repository. We are prompted to confirm the action before the script is deleted.
The message Script(s) deleted shows above the updated list of scripts.
Copying a SQL Script
To save the script, we copy the script in the script repository. Follow the steps given below, to copy a SQL Script.
- Click on the SQL Workshop and open SQL Script on the workspace homepage.
- Load the script to be copied to the editor.
- Enter the name of a copied script into script field.
- Click on Save button to save the copy of the script in the script repository field.