Category: DBMS

SQL – Year wise Student Count

                    SQL - Year wise Student Count                                       student is a database table containing whose create DDL is given below. CREATE TABLE student(id int, name VARCHAR(100), department VARCHAR(3), year int); Write the SQL to list the year

SQL – Select all 4th Year Students from IT department

    SQL - Select all 4th Year Students from IT department The students table has the following four columns id name department year The table DDL is as below. CREATE TABLE students(id int,name VARCHAR(100), department VARCHAR(3),year int); Write the SQL statement to fetch the records (all the columns) of the students belonging to year as 4 and department

Average Population | SQL – HackerRank

                                               Given the CITY and COUNTRY tables, query the names of all the continents (COUNTRY.Continent) and their respective average city populations (CITY.Population) rounded down to the nearest integer. Note: CITY.CountryCode and COUNTRY.Code are matching key columns. Do not include continents without cities in

African Cities | SQL:- Hackerrank

                                         Given the CITY and COUNTRY tables, query the names of all cities where the CONTINENT is 'Africa'. Note: CITY.CountryCode and COUNTRY.Code are matching key columns. Input Format The CITY and COUNTRY tables are described as follows: Query: select city.name. from city INNER JOIN country ON city.countrycode=country.code where continent='Africa';

Asian Population | SQL

                                            Given the CITY and COUNTRY tables, query the sum of the populations of all cities where the CONTINENT is 'Asia'. Note: CITY.CountryCode and COUNTRY.Code are matching key columns. Input Format The CITY and COUNTRY tables are described as follows: Query: select sum(City.POPULATION) from Country INNER JOIN CITY ON