Está en la página 1de 12

STARTING SQL

CODE in MSSQL
Server
LESSON 3

RAYMOND S. BERMUDEZ
Instructor, College of Computer Studies - MSEUF

What is SQL?
SQL is a language that is used in to

manipulate relational databases.


Like QBE, SQL provides users with the
capability of querying a relational
database.
However, in SQL, you must enter
commands to obtain the desired results,
rather than completing an on-screen form
as you do in Access and QBE.
SQL uses commands to create tables,
update tables, and retrieve data from
tables.
The commands that are used to retrieved
BY: Mr. RAYMOND S. BERMUDEZ, - Instructor, College of Computer Studies, MSEUF Lucena City

What is SQL?
SQL was developed under the name

SEQUEL at the IBM San Jose research


facilities as the data manipulation
language for IBMs prototype
relational DBMS, System R, in the
mid-1970s.
In 1980, it was renamed SQL [but
still pronounced as sequel]
although the equally popular
pronunciation of S-Q-L to avoid
confusion with an unrelated
hardware product called SEQUEL.
BY: Mr. RAYMOND S. BERMUDEZ, - Instructor, College of Computer Studies, MSEUF Lucena City

What is SQL?
SQL is used as the data

manipulation language for IBMs


current production offerings-SQL/DS
and DB2- in the relational DBMS
arena.
Most relational DBMSs use a version

of SQL as data manipulation


language.
SQL is the standard language for
BY: Mr. RAYMOND S. BERMUDEZ, - Instructor, College of Computer Studies, MSEUF Lucena City

What is SQL?
Data Definition Language (DDL)

used to define, change, or drop


database objects
Data Manipulation Language (DML)

used to read and modify data


Data Control Language (DCL)

used to grant and revoke authorizations


Transaction Control Language (TCL)

with statements such as COMMIT,


ROLLBACK, SAVEPOINT which group DML
BY: Mr. RAYMOND S. BERMUDEZ, - Instructor, College of Computer Studies, MSEUF Lucena City
statements together to be executed as a

Introduction to Code
To open the editor:
On the main menu, you can click File

-> New -> Query With Current


Connection
On the Standard toolbar, click the
New Query button
In the Object Explorer, right-click the
name of the server and click New
Query
This would create a new window and
position it on the right side of the
interface.

BY: Mr. RAYMOND S. BERMUDEZ, - Instructor, College of Computer Studies, MSEUF Lucena City

Saving the Code


Whether you have already written
code or not, you can save the
document of the code editor at any
time. To save it:
You can press Ctrl + S
On the main menu, you can click
File -> Save SQLQueryX.sql...
On the Standard toolbar, you can
click the Save button

BY: Mr. RAYMOND S. BERMUDEZ, - Instructor, College of Computer Studies, MSEUF Lucena City

BY: Mr. RAYMOND S. BERMUDEZ, - Instructor, College of Computer Studies, MSEUF Lucena City

Executing a Statement
After writing a statement, you can
execute it, either to make it active or
simply to test it. To execute a
statement:
Press F5
On the main menu, click Query ->
Execute
On the SQL Editor toolbar, click the
Execute button
Right-click somewhere in the code
editor and click Execute
BY: Mr. RAYMOND S. BERMUDEZ, - Instructor, College of Computer Studies, MSEUF Lucena City

Executing a Statement
When you execute code, code editor
becomes divided into two horizontal
sections:

BY: Mr. RAYMOND S. BERMUDEZ, - Instructor, College of Computer Studies, MSEUF Lucena City

Executing a Statement
Also, when you
execute code,
the interpreter
would first
analyze it. If
there is an
error, it would
display one or
more lines of
error text in its
bottom section.
Here is an

BY: Mr. RAYMOND S. BERMUDEZ, - Instructor, College of Computer Studies, MSEUF Lucena City

STARTING SQL
CODE in MSSQL
Server
LESSON 3

RAYMOND S. BERMUDEZ
Instructor, College of Computer Studies - MSEUF

También podría gustarte