Question

In: Computer Science

Referencing SQL Databases Elaborate on a scenario where you can apply data manipulation commands and transaction...

Referencing SQL Databases

Elaborate on a scenario where you can apply data manipulation commands and transaction controls.

Solutions

Expert Solution

Data Manipulation Language:

DML is a subset of SQL which is used to retrieve and update the data into the database.

The command INSERT, DELETE, UPDATE are used to manipulate data.

Transaction Control Language:

TCL is a subset of SQL which is used to control the mechanism of a transaction in the database.

The command COMMIT, ROLLBACK is used to control the transaction.

Scenario to use data manipulation commands:

Let us suppose we have a database for college and want to enter the record of a new student.

Student table has three fields RollNo, Name, and Age.

INSERT INTO Student(RollNo, Name, Age)

VALUES(150, "ABC", 22)

Scenario to use transaction control commands:

Now, suppose we receive a list of 50 students and we need to enter all details into the database.

Now we will write the same statement as given above for the 50 students.

If we are not using the transaction control mechanism then in case of failure or power off there are some chances that some record are updated into the database but some records are not updated. So, we need to check for the database again to correct the database entry.

If we are using the transaction mechanism then we can use TCL command to commit a transaction as given below:

INSERT INTO Student(RollNo, Name, Age)

VALUES(150, "ABC", 22)

.

.

.

COMMIT

Now, if a failure will occur during the processing then no record will be inserted into the database. Commit means to permanently save all the changes into the database which you have made in the current transaction.


Related Solutions

Can you explain the means of “where, from, select”? Of SQL
Can you explain the means of “where, from, select”? Of SQL
Experiment with SQL queries on 2 tables: Background: Normalized databases will involve data that is organized...
Experiment with SQL queries on 2 tables: Background: Normalized databases will involve data that is organized into 2 or more tables. However, to answer queries, the data from 2 (or more) tables will need to be joined together to get the relevant information. Join operations in SQL are accomplished in the following manner: Indicate the tables involved in the query in the FROM clause Specify relationship/condition between columns in from the tables. Exercise: For this part of the exercise the...
SQL statements are divided into three major categories: Data Definition Language (DDL), Data Manipulation Language (DML),...
SQL statements are divided into three major categories: Data Definition Language (DDL), Data Manipulation Language (DML), and Data Control Language (DCL). Explain the differences between DDL, DML, and DCL commands, and provide practical examples of each.
Use the following information to create SQL commands to retrieve data from Henry Books database :...
Use the following information to create SQL commands to retrieve data from Henry Books database : For each book, list the book code, book title, publisher code, and publisher name. Order the results by publisher name. For each book published by Plume, list the book code, book title, and price. List the book title, book code, and price of each book published by Plume that has a book price of at least $14. List the book code, book title, and...
Please provide the Stata commands and outputs where necessary, thank you. 4. The following are data...
Please provide the Stata commands and outputs where necessary, thank you. 4. The following are data on y = quit rate per 100 employees in manufacturing x = unemployment rate The data are for United States and cover the period 1990-2002. Year Y X 1990 1.3 6.2 1991 1.2 7.8 1992 1.4 5.8 1993 1.4 5.7 1994 1.5 5.0 1995 1.9 4.0 1996 2.6 3.2 1997 2.3 3.6 1998 2.5 3.3 1999 2.7 3.3 2000 2.1 5.6 2001 1.8 6.8...
Discuss scenario where you apply the accounting codes of conduct and your own personal and professional...
Discuss scenario where you apply the accounting codes of conduct and your own personal and professional code of ethics. I
case study example where you can apply benners theory
case study example where you can apply benners theory
Euler’s Method and Introduction to MATLAB • Start MATLAB • Inline Commands: You can type commands...
Euler’s Method and Introduction to MATLAB • Start MATLAB • Inline Commands: You can type commands directly into the command window: Type and expression and then hit enter to evaluate the expression. For example: >> 2+2 If you want to suppress the output of a command follow it with ‘;”.  For example >>2+2; Practice evaluating a few expressions in the command window. (In MATLAB multiplication is represented by * so 3*2=6). • Variables and Vectors: You can define variables in the...
Data Manipulation In this lab, you will be manipulating the database to add, delete and modify...
Data Manipulation In this lab, you will be manipulating the database to add, delete and modify the values in the database. Please use a "select * from..." after each query to show the effects of your data manipulation query. 1. The title 'Time Flies' now has a new track, the 11th track 'Spring', which is 150 seconds long and has only a MP3 file. Insert the new track into Tracks table (Don’t hand-code any data for insert that can be...
Where are fat reserves in the body, and how much can be stored? Please elaborate for...
Where are fat reserves in the body, and how much can be stored? Please elaborate for my understanding!
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT