A

@abhijeet119

SQL Subquery Exercises

SQL
4 years ago
-- create a table CREATE TABLE students ( id INTEGER PRIMARY KEY, name TEXT NOT NULL, gender TEXT NOT NULL ); -- insert some values INSERT INTO students VALUES (1, 'Ryan', 'M'); INSERT INTO students VALUES (2, 'Joanna', 'F'); -- fetch some values

SQL JOINS: Exercise-1 with Solution

SQL
4 years ago
-- create a table CREATE TABLE students ( id INTEGER PRIMARY KEY, name TEXT NOT NULL, gender TEXT NOT NULL ); -- insert some values INSERT INTO students VALUES (1, 'Ryan', 'M'); INSERT INTO students VALUES (2, 'Joanna', 'F'); -- fetch some values

SQL Exercises, Practice, Solution - Query on Multiple Tables

SQL
4 years ago
-- write a SQL query to find the salespersons and customers who live in same city. Return customer name, salesperson name and salesperson city. SELECT customer.cust_name,salesman.name,salesman.city FROM salesman,customer WHERE salesman.city = customer.city; -- write a SQL query to find all the customers along with the salesperson who works for them. Return customer name, and salesperson name. SELECT customer.cust_name,salesman.name FROM customer,salesman WHERE salesman.salesman_id =custmer.s

SQL Exercises, Practice, Solution - Formatting Output

SQL
4 years ago
-- create a table CREATE TABLE students ( id INTEGER PRIMARY KEY, name TEXT NOT NULL, gender TEXT NOT NULL ); -- insert some values INSERT INTO students VALUES (1, 'Ryan', 'M'); INSERT INTO students VALUES (2, 'Joanna', 'F'); -- fetch some values

SQL Exercises, Practice, Solution - Aggregate Functions

SQL
4 years ago
-- write a SQL query to calculate total purchase amount of all orders SELECT SUM (purch_amt) From orders; -- write a SQL query to calculate average purchase amount of all orders SELECT AVG (purch_amt) FROM orders; -- write a SQL query to count the number of unique salespeople. SELECT Count (DISINCT salesman_id)

SQL Exercises, Practice, Solution - Wildcard and Special operators

SQL
4 years ago
-- write a SQL query to find the details of those salespeople who come from the 'Paris' City or 'Rome' City. SELECT * FROM Salesman Where city='Paris' OR city='Rome'; -- write a SQL query to find the details of those salespeople who come from any of the City 'Paris' or 'Rome' SELECT * FROM Salesman Where city IN('Paris','Rome'); -- write a SQL query to find the details of those salespeople who live in cities apart from 'Paris' and 'Rome'. SELECT * FROM Salesman

SQL Exercises, Practice, Solution - Using Boolean and Relational operators

SQL
4 years ago
-- write a SQL query to find the details of the customers who have a gradevalue above 100. SELECT *FROM customer WHERE grade>100; -- write a SQL query to find all the customers in ‘New York’ city who have a grade value above 100. SELECT * FROM customer WHERE city='New York' AND grade=100; -- write a SQL query to find the customers who belong to either the city ‘New York’ or have a grade above 100 SELECT *FROM customer

W3 resource SQL exercises

SQL
4 years ago
-- Sql statement to display the information of all salesman SELECT * FROM salesman; -- Write a query to display a string "This is SQL Exercise, Practice and Solution". SELECT "This is SQL Exercise, Practice and Solution"; -- Write a query to display three numbers in three columns. SELECT 5,10,15; -- Write a query to display the sum of two numbers 10 and 15 from RDMS sever SELECT 10+15;