Write a sql statement to display names and city of salesman, who belongs to the city of paris

Select all records where the City column has the value 'Berlin' or 'London'.

@(6) * FROM Customers @(5) City = 'Berlin' @(2) @(4) = '@(6)';

SELECT * FROM Customers WHERE City = 'Berlin' OR City = 'London';

Correct!

Next ❯

e. Write a SQL query to display those customers who are neither belongs to the city New York nor grade valueis more than 100.

Last update on August 19 2022 21:50:36 (UTC/GMT +8 hours)

From the following tables write a SQL query to find the salesperson and customer who reside in the same city. Return Salesman, cust_name and city.

Sample table: salesman


Sample table: customer


Sample Solution:

SELECT salesman.name AS "Salesman", customer.cust_name, customer.city FROM salesman,customer WHERE salesman.city=customer.city;

Output of the Query:

Salesman cust_name city James Hoog Nick Rimando New York James Hoog Brad Davis New York Pit Alex Julian Green London Mc Lyon Fabian Johnson Paris Nail Knite Fabian Johnson Paris Pit Alex Brad Guzan London

Explanation:

Write a sql statement to display names and city of salesman, who belongs to the city of paris

Pictorial presentation:

Write a sql statement to display names and city of salesman, who belongs to the city of paris

Practice Online

Query Visualization:

Duration:

Write a sql statement to display names and city of salesman, who belongs to the city of paris

Rows:

Write a sql statement to display names and city of salesman, who belongs to the city of paris

Cost:

Write a sql statement to display names and city of salesman, who belongs to the city of paris

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous SQL Exercise: SQL JOINS Exercises Home
Next SQL Exercise: Customers and their cities for given range of orders.

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.



WHERE vs HAVING?

WHERE is applied before GROUP BY, HAVING is applied after (and can filter on aggregates).

In general, you can reference aliases in neither of these clauses, but MySQL allows referencing SELECT level aliases in GROUP BY, ORDER BY and HAVING.

Ref : https://bit.ly/3FeA9Qn

Write a sql statement to display names and city of salesman, who belongs to the city of paris
  • Exercises: Weekly Top 16 Most Popular Topics
  • SQL Exercises, Practice, Solution - JOINS
  • SQL Exercises, Practice, Solution - SUBQUERIES
  • JavaScript basic - Exercises, Practice, Solution
  • Java Array: Exercises, Practice, Solution
  • C Programming Exercises, Practice, Solution : Conditional Statement
  • HR Database - SORT FILTER: Exercises, Practice, Solution
  • C Programming Exercises, Practice, Solution : String
  • Python Data Types: Dictionary - Exercises, Practice, Solution
  • Python Programming Puzzles - Exercises, Practice, Solution
  • C++ Array: Exercises, Practice, Solution
  • JavaScript conditional statements and loops - Exercises, Practice, Solution
  • C# Sharp Basic Algorithm: Exercises, Practice, Solution
  • Python Lambda - Exercises, Practice, Solution
  • Python Pandas DataFrame: Exercises, Practice, Solution
  • Conversion Tools
  • JavaScript: HTML Form Validation