Advanced Mysql Sub Complex join Queries Tutorial
In this Post We Will Explain About is Advanced Mysql Sub Complex join Queries Tutorial With Example and Demo.Welcome on infinityknow.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to How to create a relatively complex MySQL queryExample
In this post we will show you Best way to implement Complex MySQL query with multiple select statements, hear for sql – Tutorial that teaches simple to complex mysql querieswith Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.
Find the branch number and address..
1) SELECT * from Branch where city = ‘London’;
From this we can get the branch no , street and postal code
Find the Name of all property….
2) SELECT Privateowner.fname, Privateowner.lname FROM Privateowner INNER JOIN PropertyForRent ON Privateowner.ownerno = PropertyForRent.ownerno where PropertyForRent.staffno =(select staffno from Staff where fname=”Ann” and lname = “Beech”);
Find the avarage salary of people..
3) SELECT AVG(Staff.salary) FROM Staff INNER JOIN Branch ON Staff.branchno = Branch.branchno where Branch.city = ‘London’;
Find the name of city for whom no suitable…
4) SELECT Client.fname, Client.lname FROM Client INNER JOIN PropertyForRent ON Client.preftype = PropertyForRent.type;
Find the name of clients for whom no suitable..
5) SELECT Staff.fname, manager from Staff where manager IS NOT NULL
In this query we can get staff name and manager staffnumber using the staffno we can retrive the manager name
SELECT Staff.fname from Staff where staffno = manager;
Return the 2nd heighest salary of the staff..
6) SELECT fname, MAX(salary) AS salary FROM Staff WHERE salary < (SELECT MAX(salary) FROM Staff);
Find the owner who has the most properties…
7) SELECT Privateowner.fname, Privateowner.lname FROM Privateowner INNER JOIN PropertyForRent ON Privateowner.ownerno = PropertyForRent.ownerno where PropertyForRent.propertyno =(select propertyno from Viewing where viewdate IS NULL);
Find the number of property views per branch…..
8) SELECT COUNT(Viewing.propertyno) FROM Viewing INNER JOIN PropertyForRent ON Viewing.propertyno = PropertyForRent.propertyno where PropertyForRent.branchno = (SELECT branchno FROM Registration WHERE dateJoined BETWEEN DATE_SUB(NOW(), INTERVAL 1 MONTH) AND DATE_SUB(NOW(), INTERVAL 2 MONTH) AND DATE_SUB(NOW(), INTERVAL 3 MONTH));
I hope you have Got What is Complex MySQL query with multiple select statements And how it works.I would Like to have FeadBack From My Blog(infinityknow.com) readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article(infinityknow.com) Are Most Always Welcome.