Menu

Question Discussion & Solution

MCQ
Q.
Dates must be specified in the format

forum Community Discussion

speaker_notes_off

No discussions yet. Be the first to start!

You must be logged in to participate in the discussion.

login Login to Discuss

auto_awesome Similar Questions

MCQ
1.
supported trigger?
forum Discussion
MCQ
2.
Which of the following should be used to find the mean of the salary ?
forum Discussion
MCQ
3.
Which of the following is the syntax for views where v is view name?
forum Discussion
MCQ
4.
What will be the result of the query?
forum Discussion
NAT
5.
Consider a table **EmployeeLogs(emp_id INT, log_time TIMESTAMP, action VARCHAR(10))** where **action ∈ { 'LOGIN', 'LOGOUT' }**. Each employee may log in and out multiple times per day. Assume the table contains **10,00,000 rows**, and the following advanced SQL query is executed on a PostgreSQL-like system: ``` WITH session_pairs AS ( SELECT emp_id, log_time AS login_time, LEAD(log_time) OVER (PARTITION BY emp_id ORDER BY log_time) AS logout_time, LEAD(action) OVER (PARTITION BY emp_id ORDER BY log_time) AS next_action FROM EmployeeLogs ) SELECT COUNT(*) FROM session_pairs WHERE next_action = 'LOGOUT' AND logout_time IS NOT NULL AND logout_time > login_time; ``` Assume: - For every employee, **exactly 60%** of all rows are `'LOGIN'` actions. - Every `'LOGIN'` is eventually followed by a `'LOGOUT'` for the same employee. - No two consecutive actions for the same employee are `'LOGIN'`. - The distribution of rows across employees does not affect the ratio. Compute the **exact number of valid login–logout session pairs** returned by the query. Give the numerical answer.
forum Discussion

category More Database Management System Topics

article

Miscellaneous or General

format_list_bulleted 71 MCQs
article

Relational Algebra

format_list_bulleted 3 MCQs
article

Database Systems

format_list_bulleted 49 MCQs
article

Data Models

format_list_bulleted 16 MCQs
article

The Relational Database Model

format_list_bulleted 58 MCQs
article

Entity Relationship (ER) Modeling

format_list_bulleted 59 MCQs
article

Advanced Data Modeling

format_list_bulleted 1 MCQs
article

Normalization

format_list_bulleted 58 MCQs
article

Structured Query Language (SQL)

format_list_bulleted 7 MCQs
article

Advanced SQL

format_list_bulleted 90 MCQs
article

Database Design

format_list_bulleted 2 MCQs
article

Transaction and Concurrency

format_list_bulleted 10 MCQs
article

Data Warehouses

format_list_bulleted 10 MCQs
article

Database Administration

format_list_bulleted 1 MCQs
article

Mixed

format_list_bulleted 10 MCQs