SQL VIEW Exercises: Create a view to find the salesmen of the city New York
SQL VIEW : Exercise-3 with Solution
3. From the following table, create a view to find the salespersons of the city 'New York'.
Sample table: salesman
Code to create the view
CREATE VIEW newyorkstaff AS SELECT * FROM salesman WHERE city = 'New York';
Code to see the records form the view
SELECT * FROM newyorkstaff WHERE commission > .13;
sqlpractice=# SELECT * sqlpractice-# FROM newyorkstaff sqlpractice-# WHERE commission > .13; salesman_id | name | city | commission -------------+------------+----------+------------ 5001 | James Hoog | New York | 0.15 (1 row)
Inventory database model:
Contribute your code and comments through Disqus.
Previous: From the following table, create a view for all salespersons. Return salesperson ID, name, and city.
Next: From the following table, create a view to count the number of customers in each grade.
Test your Programming skills with w3resource's quiz.
What is the difficulty level of this exercise?
SQL: Tips of the Day
How to insert a line break in a SQL Server VARCHAR/NVARCHAR string?
DECLARE @text NVARCHAR(100) SET @text = 'This is line 1.' + CHAR(13) + 'This is line 2.' SELECT @text
This prints out the following:
This is line 1.
This is line 2.
Database: SQL Server
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework