Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
sravani solasa
Starting Member
6 Posts |
Posted - 2011-06-24 : 22:15:53
|
| The database of naval ships that took part in World War II is under consideration. The database has the following relations:Classes(class, type, country, numGuns, bore, displacement)Ships(name, class, launched)Battles(name, date)Outcomes(ship, battle, result)Ships in classes are arranged to a single project. A class is normally assigned the name of the first ship in the class under consideration (head ship); otherwise, the class name does not coincide with any ship name in the database.The Classes relation includes the class name, type (bb for a battle ship, or bc for a battle cruiser), country where the ship was built, number of main guns, gun caliber (diameter of the gun barrel, in inches), and displacement (weight in tons). The Ships relation includes the ship name, its class name, and launch year. The Battles relation covers the name and date of a battle the ships participated; while the result of their participation in the battle (sunk, damaged, or unharmed - OK) is in the Outcomes relation. Note: the Outcomes relation may include the ships not included in the Ships relation.One of characteristics of a ship is one-half cube of calibre of its main guns (mw). Within 2 decimal places, define the average value of mw for the ships of each country which has ships in database. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
sravani solasa
Starting Member
6 Posts |
Posted - 2011-06-25 : 00:38:55
|
| In the above query he asked about one-half cube of caliber how to calculate this one half cube? |
 |
|
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2011-06-25 : 00:43:45
|
| One half cube = 0.5 * calibre^3Hope that helps. Again, you need to work on your homework. We're happy to help, but you need to put forth some serious effort yourself. |
 |
|
|
sravani solasa
Starting Member
6 Posts |
Posted - 2011-06-25 : 01:05:29
|
| Ok sure...........I am new to sqlserver.For practising I am learning those queries. Thanks |
 |
|
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2011-06-25 : 01:41:13
|
| Great. Keep posting back if you get stuck. |
 |
|
|
Jozhik
Starting Member
1 Post |
Posted - 2011-11-24 : 11:37:17
|
| Good day!My request is select country, cast(avg(mw) as numeric(6,2)) mw from (select bore*bore*bore/2 mw, country from classes, ships where classes.class=ships.class and bore is not null and country is not nullunion allselect bore*bore*bore/2 mw, country from classes, outcomes where classes.class=outcomes.ship and outcomes.ship not in (select name from ships) and country is not null and bore is not null) Xgroup by countryBut it failed test on second, checking database.* Data mismatch (1) |
 |
|
|
|
|
|
|
|