0% found this document useful (0 votes)
45 views

Advantages of SQL

SQL is a language used to create and manage databases and access and modify data in relational database management systems. It allows users to easily create and manipulate databases without programming. Key SQL functions include creating tables with columns of different data types, performing full or differential backups of databases, and restoring databases from backup files. The DELETE command removes specific rows from a table while the TRUNCATE command removes all rows faster but without logging changes.

Uploaded by

latha sri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views

Advantages of SQL

SQL is a language used to create and manage databases and access and modify data in relational database management systems. It allows users to easily create and manipulate databases without programming. Key SQL functions include creating tables with columns of different data types, performing full or differential backups of databases, and restoring databases from backup files. The DELETE command removes specific rows from a table while the TRUNCATE command removes all rows faster but without logging changes.

Uploaded by

latha sri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

SQL

What is SQL?

SQL is a short-form of the structured query language. This database language is mainly
designed for maintaining the data in relational database management systems.

You can easily create and manipulate the database, access and modify the table rows and
columns, etc.

Advantages of SQL

1.No programming needed

2. High-Speed Query Processing

3. Standardized Language

4. Portability

5. Interactive language

Disadvantages of SQL

With the advantages of SQL, it also has some disadvantages, which are as follows:

 1 Cost

 2. Interface is Complex
 3. Partial Database control

2.How to Create Database in SQL?

SQL CREATE TABLE statement is used to create table in a database.

If you want to create a table, you should name the table and define its column and each
column's data type.
Let's see the simple syntax to create the table.

1. create table "tablename"  
2. ("column1" "data type",  
3. "column2" "data type",  
4. "column3" "data type",  
5. ...  
6. "columnN" "data type");  
EXAMPLE

7. The following example creates a table called "Persons" that contains five columns:
PersonID, Last Name, FirstName, Address, and City:

CREATE TABLE Persons
(
    PersonID int,
    Last Name varchar (255),
    FirstName varchar (255),
    Address varchar (255),
    City varchar (255)
);

 The PersonID column is of type int and will hold an integer.


 The Last Name, FirstName, Address, and City columns are of type varchar and will
hold characters, and the maximum length for these fields is 255 characters.
 The empty "Persons" table will now look like this:

PersonID Last Name FirstName Address City

Tip: The empty "Persons" table can now be filled with data with the SQL INSERT
INTO statement.
3.TYPES OF BACKUPS IN SQL?

Following are the most common types of backups available in SQL Server:

1. Full
2. Differential
3. Transaction log

Full backups

A full backup, as the name implies, backs up everything. It is the foundation of any kind of
backup. This is a complete copy, which stores all the objects of the database: Tables,
procedures, functions, views, indexes etc.

A full backup must be done at least once before any of the other types of backups can be run
this is the foundation for every other kind of backup.

Differential Backups

A differential backup is a data backup that copies all of the files that have changed since the
last full backup was performed. This includes any data that has been created, updated or
altered in any way and does not copy all of the data every time. Differential backups save
storage space and the time it takes for a backup
Transaction Log Backup

The log backup, as its name implies, backs up the transaction logs. This backup type is
possible only with full or bulk-logged recovery models. A transaction log file stores a series
of the logs that provide the history of every modification of data, in a database. A transaction
log backup contains all log records that have not been included in the last transaction log
backup.

It allows the database to be recovered to a specific point in time.

Transaction Log Backup


4.How to

A) Backup and

b) Restore a Database in SQL via the GUI?

a)Backup a Database in SQL?

1.Launch the Back Up Database Dialog Box

in the Object Explorer, right-click on the database you'd like to back up, and select Tasks >
Back Up... from the contextual menu

2.Review the Backup Settings

This dialog box gives you the opportunity to change any of the settings if required.

For our example, leave it at the default settings and click OK to create the backup.

3.Backup Complete

You'll receive a message when the backup is complete.

Click OK to close the message and dialog box.

The backup file will now be located at the specified location.

SHORT

1. Launch the Back Up Database Dialog Box. In the Object Explorer, right-click on the
database you'd like to back up, and select Tasks > Back Up... from the contextual
menu.
2. Review the Backup Settings. ...
3. Backup Complete.
Restore a Database via the GUI

1. Launch the Restore Database Dialog Box. In the Object Explorer, right-click on the
Databases node and select Restore Database... from the contextual menu.
2. Select the Backup File. ...
3. Select the Backup File. ...
4. Check the Settings. ...
5. Success Message. ...
6. Check the Database.

5.WHAT DIFFERENCE BETWEEN DELETE AND TRUNCATE?


SI.NO DELETE TRUNCATE
1 The DELETE command is used While this command is used to delete
to delete specified rows (one or all the rows from a table.
more).
2 It is a DML (Data Manipulation While it is a DDL(Data Definition
Language) command. Language) command.
3 DELETE command is slower While TRUNCATE command is faster
than TRUNCATE command. than DELETE command.
4 To use Truncate on a table we need at
To use Delete you need DELETE least ALTER permission on the table.
permission on the table.

You might also like