What is a Query in DBMS?
发布时间:2026-09-21 | 浏览:1
Interview Questions
Acid Properties
Data Warehousing
Compiler Design
Computer Network
Digital Electronics
In the field of Database Management Systems (DBMS), a query serves as a fundamental tool for retrieving, manipulating, and managing data stored within a database. Queries act as the bridge between users and databases, enabling them to communicate with the system to extract specific information or perform various operations on the data. Understanding the nuances of queries and their associated terminologies is crucial for anyone working with databases, whether as a developer, analyst, or database administrator.
What is a Query in DBMS?
A query in a DBMS is a request made by a user or application to retrieve or manipulate data stored in a database. This request is typically formulated using a structured query language (SQL) or a query interface provided by the DBMS . The primary purpose of a query is to specify precisely what data is needed and how it should be retrieved or modified.
Terminologies Related to Queries
A structured collection of data organized for efficient retrieval and storage. It serves as the repository for data accessed and manipulated through queries.
SQL (Structured Query Language)
A standardized programming language used to interact with relational databases. SQL provides a set of commands for querying, updating, and managing databases.
A fundamental component of a relational database, representing a collection of related data organized into rows and columns. Each table in a database typically corresponds to a specific entity or concept.
A single piece of data stored within a table, representing a specific attribute or characteristic of the entities described by the table.
A complete set of data representing an individual instance or entity stored within a table. Each row contains values for each field/column defined in the table schema.
A unique identifier for each record in a table, ensuring that each row can be uniquely identified and accessed. Primary keys are used to establish relationships between tables and enforce data integrity.
The language used to communicate with a database management system. This language allows users to perform operations such as data retrieval, manipulation, and schema definition.
Major Commands in SQL with Examples
To illustrate the major SQL commands, let's use a SQL ite database file named `company.db`, which contains a table named `employees`. We'll demonstrate various SQL commands with real changes to this database.
Example Database Structure
Table: employees
SELECT Statement
The SELECT statement is used to retrieve data from one or more tables in a database.
This query selects all columns from the "employees" table where the department is 'IT'.
INSERT Statement
The INSERT statement is used to add new records into a table.
This query inserts a new employee record into the "employees" table with specified values.
To see, if the new data has been successfully inserted, you can execute the SELECT command, like this
Now, you'll get the entire table and you can see that the new data has been added to the database
UPDATE Statement
The UPDATE statement is used to modify existing records in a table.
This query updates the department of the employee named 'Michael Lee' to 'Operations'.
Let's run the SELECT command to see the updated database
You can see that, the database has been updated and now Michael's department is set to Operations
DELETE Statement
The DELETE statement is used to remove existing records from a table.
This query deletes records from the "employees" table where the age is greater than 35.
Execute the SELECT command to check the updated database:
You can see that Michael has been removed from the database as he is the only one with an age over 35.
Introduction of DBMS 6 min read
History of DBMS 6 min read
Types of DBMS Architecture 5 min read
Difference between File System and DBMS 6 min read
Introduction of ER Model 9 min read
Structural Constraints of Relationships in ER Model 5 min read
Generalization, Specialization and Aggregation in ER Model 3 min read
Introduction of Relational Model and Codd Rules in DBMS 14 min read
Keys in Relational Model 7 min read
Mapping from ER Model to Relational Model 5 min read
Strategies for Schema design in DBMS 6 min read
Introduction to Relational Algebra in DBMS 8 min read
SQL Joins (Inner, Left, Right and Full Join) 3 min read
Join Operation vs Nested Query in DBMS 3 min read
Tuple Relational Calculus (TRC) in DBMS 4 min read
Domain Relational Calculus in DBMS 4 min read
Attribute Closure in DBMS 4 min read
Armstrong's Axioms in Functional Dependency in DBMS 4 min read
Canonical Cover of Functional Dependencies in DBMS 7 min read
Normal Forms in DBMS 5 min read
The Problem of Redundancy in Database 3 min read
Lossless Join and Dependency Preserving Decomposition 4 min read
Denormalization in Databases 4 min read
ACID Properties in DBMS 5 min read
Types of Schedules in DBMS 5 min read
Concurrency Control in DBMS 3 min read
Graph Based Concurrency Control Protocol in DBMS 3 min read
Multiple Granularity Locking in DBMS 3 min read
Database Recovery Techniques in DBMS 4 min read
Deadlock in DBMS 4 min read
Indexing in Databases 6 min read
Introduction of B Tree 7 min read
Introduction of B+ Tree 5 min read
Bitmap Indexing in DBMS 3 min read
Inverted Index 7 min read
SQL Queries on Clustered and Non-Clustered Indexes 6 min read
File Organization in DBMS 4 min read
Last Minute Notes - DBMS 15+ min read
DBMS Interview Questions with Answers 15+ min read
Commonly asked DBMS Interview Questions | Set 2 5 min read
Database Management System - GATE CSE Previous Year Questions 2 min read
GATE CS/IT/DA Courses 2 min read
Placement 360 Course 2 min read