Found 15 Questions For DBMS

How to Find the Nth Highest Salary in SQL ?

Updated on 20-Jun-2024 17:29:50
Finding the nth highest salary in SQL is a common interview question and a practical task in database management. Here are several approaches to solve this problem, each with detailed explanations and examples. We'll assume we have a table `Employee` with columns `id`, `name`, and `salary`. ID Name Salary 1 Alice 60000 2 Bob 70000 3 Charlie 80000 4 David 70000 5 Eve 90000 1. Using Subquery with `DISTINCT` and `LIMIT`/`OFFSET` This approach involves using a subquery to first s... Read Mores

How to insert multiple rows in SQL ?

Updated on 16-Dec-2021 16:49:13
To insert multiple rows in SQL we can follow the below syntax: INSERT INTO table_name (column1, column2,column3...) VALUES (value1, value2, value3…..), (value1, value2, value3….), ... (value1, value2, value3); We start off by giving the keywords INSERT INTO then we give the name of the table into which we would want to insert the values. We will follow it up with the list of the columns, for which we would have to add the values. Then we will give in the VALUES key... Read Mores

What is a trigger in SQL ?

Updated on 16-Dec-2021 16:46:22
A trigger is a stored program in a database which automatically gives responses to an event of DML operations done by insert, update, or delete. In other words, is nothing but an auditor of events happening across all database tables. Let’s look at an example of a trigger : CREATE TRIGGER bank_trans_hv_alert BEFORE UPDATE ON bank_account_transaction FOR EACH ROW begin if( abs(:new.transaction_amount)>999999)THEN RAISE_APPLICATION_ERROR(-20000, 'Account transaction exceedi... Read Mores

What is a unique key in SQL ?

Updated on 16-Dec-2021 16:40:54
Unique Key is a constraint in SQL. So, before understanding what exactly is a primary key, let’s understand what exactly is a constraint in SQL. Constraints are the rules enforced on data columns on a table. These are used to limit the type of data that can go into a table. Constraints can either be column level or table level. Unique Key:  Whenever we give the constraint of unique key to a column, this would mean that the column cannot have any duplicate values present in it. In other ... Read Mores

How to delete a column in SQL ?

Updated on 16-Dec-2021 16:39:14
To delete a column in SQL we will be using DROP COLUMN method: ALTER TABLE employees DROP COLUMN age; We will start off by giving the keywords ALTER TABLE, then we will give the name of the table, following which we will give the keywords DROP COLUMN and finally give the name of the column which we would want to remove.... Read Mores

What is a schema in SQL ?

Updated on 16-Dec-2021 16:35:48
Our database comprises of a lot of different entities such as tables, stored procedures, functions, database owners and so on. To make sense of how all these different entities interact, we would need the help of schema. So, you can consider schema to be the logical relationship between all the different entities which are present in the database. Once we have a clear understanding of the schema, this helps in a lot of ways: We can decide which user has access to which tables in the data... Read Mores

What is OLAP ?

Updated on 16-Dec-2021 16:34:02
OLAP stands for Online Analytical Processing. And a class of software programs which are characterized by relatively low frequency of online transactions. Queries are often too complex and involve a bunch of aggregations.... Read Mores

What is Data Integrity ?

Updated on 16-Dec-2021 16:32:22
Data Integrity is the assurance of accuracy and consistency of data over its entire life-cycle, and is a critical aspect to the design, implementation and usage of any system which stores, processes, or retrieves data. It also defines integrity constraints to enforce business rules on the data when it is entered into an application or a database.... Read Mores

What is OLTP ?

Updated on 16-Dec-2021 16:30:58
OLTP stands for Online Transaction Processing. And is a class of software applications capable of supporting transaction-oriented programs. An essential attribute of an OLTP system is its ability to maintain concurrency... Read Mores

What are Nested Triggers ?

Updated on 16-Dec-2021 16:29:11
Triggers may implement DML by using INSERT, UPDATE, and DELETE statements. These triggers that contain DML and find other triggers for data modification are called Nested Triggers.... Read Mores
1 2 Next