i have 3 tables
student table
roll no name
sub table
roll no subid subname
markstable
roll no subid marks
1)select name,subname,marks whose having marks less than 40
2)select sub name,marks whose having avg above 60%
3)select rank of each student
can any one tell me the query for that

Hello

How should your letter sequences be read? Does "no" belongs to "name" so as "nonname" or is it a single column's name? What are "sub" and "table" ? Maybe these separated words are name of many-to-many linking table? Are there any keys?

Most Important: All your four anwsers can easily be found by way of sub-selects, in principle:

select t.this, o.and, y.that from there t  join overthere o join yonder y  -- the many-to-many inner join
  where theunknown ??which_predicate?? (select ... yes, i am a subselect ...);

This select only works fine, if you know your primary and foreign keys, furthermore, they must be defined correctly. If you don't know, you have to state them explicitely by ON clause for every table in FROM-clause, or if this sort of modern joins be not allowed, you have to put join constraints in WHERE clause, traditionally.

Getting these hints (ok, you also need to know where to place aggregate function avg(?) and how to build a perfect GROUP BY clause), it should be really easy for you to find the appropriate answers. You may post in what you will have found then.

-- tesu

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.