Dml data manipulation language what it is a data

Info icon This preview shows pages 22–24. Sign up to view the full content.

View Full Document Right Arrow Icon
DML (Data-Manipulation Language): What it is A data-manipulation language is a language that enables users to access or manipulate data as organized by the appropriate data model. Data-manipulation is head2right The retrieval of information stored in the database head2right The insertion of new information into the database head2right The deletion of information from the database head2right The modification of information stored in the database Query Language A query is a statement requesting the retrieval of information. The portion of a DML that involves information retrieval is called a query language . Although technically incorrect, it is common practice to use the terms query language and data-manipulation language synonymously. The SELECT Operation / Statement The SELECT statement is used to retrieve information from the database according to provided conditions. To demonstrate the use of SELECT statement, let’s assume the following two relation instances. customer_name customer_street customer_city account_number customer_name balance Somebody Mirpur Road Dhaka A-101 Anybody 1000 Somebody Aga Kha Road Bogra A-102 Anybody 1500 Anybody XYZ Road Khagrachhori A-103 Somebody 2000 Nobody Mirpur Road Dhaka A-104 Nobody 2500 customer account Q1. From the customer table, find out the information of all the customers who live in Dhaka. select * from customer where customer_city = 'Dhaka' ; Output: customer_name customer_street customer_city Somebody Mirpur Road Dhaka Nobody Mirpur Road Dhaka Q2. From the customer table, find out the information of all the customers who live in either Dhaka or Bogra. select * from customer where customer_city = 'Dhaka' or customer_city = 'Bogra' ; Output: customer_name customer_street customer_city Somebody Mirpur Road Dhaka Somebody Aga Kha Road Bogra Nobody Mirpur Road Dhaka
Image of page 22

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
19 Q3. Find out the customers along with their account numbers who have account balances of at least 2000 taka. select customer_name, account_number from account where balance >= 2000 ; Output: customer_name account_number Somebody A-103 Nobody A-104 From the above three queries, we can observe the general structure for the select statement: SELECT attribute_1 , attribute_2 , ... , attribute_N FROM table WHERE expression The attributes after the SELECT phrase are those attributes which we want to display at the output result. If an asterisk ( * ) is placed after the select phrase instead of attribute names, it would mean that we want all the attributes at the output. The table name after the FROM clause refers to the relation from which we want to perform the query. The expressions after the WHERE clause contains the actual query. The expressions may contain the following operators: Comparison operators: < , <= , > , >= , = , <> Logical connectives: AND , OR , NOT Simplified operators: this BETWEEN some_value AND some_other_value , this NOT BETWEEN some_value AND some_other_value [These are the substitutes for: this <= some_value AND this >= some_other_value ] Q4. From the following table named result , find out the students (along with their marks) who have scored more than 80 marks, and display them in the descending order of their marks.
Image of page 23
Image of page 24
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern