One of the SQL questions recently asked in PwC interview.
Given us Employee table, We need to Find the percentage of Genders.
In order to solve this questions, we used Case Statement and GroupBy count.
Let us create table and insert data
CREATE TABLE employees_tbl (eid INT, ename VARCHAR(50), gender VARCHAR(10))
INSERT INTO employees_tbl VALUES (1, 'John Doe', 'Male'),(2, 'Jane Smith', 'Female'),
(3, 'Michael Johnson', 'Male'),(4, 'Emily Davis', 'Female'),(5, 'Robert Brown', 'Male'),
(6, 'Sophia Wilson', 'Female'),(7, 'David Lee', 'Male'),(8, 'Emma White', 'Female'),
(9, 'James Taylor', 'Male'),(10, 'William Clark', 'Male')
For more SQL interview questions. Check out our playlist.
• SQL Interview Questions
Contact us:
info@cloudchallengers.com
Follow us on
Instagram : cloudchallengers
Facebook : cloudchallengers
LinkedIn : linkedin.com/company/cloudchallengers
29 июл 2024