Monday, February 18, 2008

SQL Statements

Creating two database tables-
1) Sign in to http://db.zoho.com/
2) On the create database page select one of the four options indicated.
3) In the create database (import) window that appears (step 1 of 2), enter the database name and description. Select the data location option i.e. pasted data or local drive.
4) Select Next.
5) Enter the table name in the window that appears next(step 2 of 3), click create. In the Import Data Details window that appears next, click close. The database table would get created.Repeat the procedure for the second database table.

Creating three select queries:
1) Locate the New option in the top left corner of the page and in the drop down box click the New Query Table option.
2) A new query table creation option would appear next. Enter the select command that you require, in the space provided and click execute. The query table would get created.
3) Repeat the procedure for the other two query tables.
4) In each of the query table select the embedding option frpm the Publish option on the top of the page. Select the URL from the window that appears.
5) Paste the URL in the post in your blog after making the necessary changes to the size of the table.
6) Publish the post.

Query 1
SELECT "Stream", Count("Stream") FROM "Marks" group by "Stream"
Output 1


Query 2
SELECT "Name", "Surname", 'from', "Home", 'has scored first class throughout his career' from "Marks" where ("10th" > '60' and "12th" > '60' and "Grad." > '60') order by (("10th"+"12th"+"Grad.")/3) desc
Output 2


Query 3
SELECT "Name", "E-mail", "Specialisation","Location" FROM "Placement" where ("Location" = 'Mumbai' or "Location" = 'Kolkata') and "Placement Status" = 'Placed'
Output 3

1 comment:

Calcutta said...

clever queries :) but why no joins across tables ??? good job anyway