question

nilesh_patil_99 avatar image
nilesh_patil_99 asked

Need Help: Primary Key and Foreign Key Queries

Hello everyone I am new to SQL and need assistance with below 3 queries. I have 2 tables Dept and Emp. **Table 1: Dept** dno int primary Key, dname text (dname can be 'Marketing', 'Production', 'Operations', 'Finance', 'IT', 'HR') **Table 2: Emp** eid int primary key, ename text, esal int, designation text, username text, password text, dno int (dno is foreign key) Based on above 2 tables I want to find below answers. 1) Count all employees belonging to the Marketing 2) Display the employee name, department and salary of an employee earning maximum salary 3) Write a function that accepts the dept name and gives the average salary of employees working in that department Thanks in Advance!
t-sqlsql query
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

This looks like homework. What have you tried so far?
0 Likes 0 ·

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.