Let's come to the point.
I have created an Awesome SQL Interview GitHub repo to prepare for interview questions and practice SQL queries. I have divided the SQL queries into three sections: Basic (L0), Intermediate (L1), and Advanced (L2). This is the solution for the basic section.
How do you display all columns and rows from the customers table?
Write a query to retrieve only the customerName and phone from the customers table.
How do you list all rows where country is 'USA' in the customers table?
Write a query to find all products in the products table with a buyPrice less than 50.
Fetch all orders with a status of 'Shipped' from the orders table.
Display the productName and quantityInStock for all products in the products table.
Find the distinct country values in the customers table.
Count the total number of customers in the customers table.
Retrieve all employees whose jobTitle is 'Sales Rep'?
Sort the products table by productName in ascending order.
Fetch the customerName and city of all customers located in 'Paris'.
Display the top 10 orders from the orders table based on the orderDate.
Retrieve all offices located in the USA.
Display all employees who work in the office located in 'San Francisco'.
Calculate the total number of orders placed in the orders table.
Display the productName of all products in the products table where productLine is 'Classic Cars'.
Find the customerName of all customers whose creditLimit is greater than 50,000.
Fetch all products that have a quantityInStock between 10 and 100.
Retrieve all orders placed in the year 2003?
Display the employeeNumber and firstName of employees whose last names start with 'B'.
Hey, My name is Jaimin Baria AKA Cloud Boy..., If you have enjoyed and learned something useful, like this post, add a comment, and visit my Awesome SQL Interview GitHub repo.
Don't forget to give it a start ?.
Happy Coding ??
The above is the detailed content of SQL Basic Question for interview. For more information, please follow other related articles on the PHP Chinese website!