473,387 Members | 1,495 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

COUNT AND display and Column Name in ORACLE 10G

How to *Count the number of Dr who are visiting 'KEM" hospital in Many to Many Relationship

I have created 3 Tables
Doctor dno PRIMARY KEY
Hospital dno PRIMARY KEY
Dochos dno REFERENCES Doctor
hno REFERENCES Hospital

CREATE TABLE Doctor (
dno NUMBER(7) PRIMARY KEY,
dname VARCHAR2(33),
city VARCHAR2(33) not null);

INSERT INTO Doctor VALUES (&dno, &dname, &City);

[CODEE]CREATE TABLE Hospital (
hno NUMBER(7) PRIMARY KEY,
hname VARCHAR2(20),
hcity VARCHAR2(20) not null);

INSERT INTO Hospital VALUES (&hno, &hame, &hcity);

CREATE TABLE Dochos (
dno NUMBER(7) REFERENCES Doctor,
hno NUMBER(7) REFERENCES Hospital);

INSERT INTO Dochos VALUES (&dno, &hno);


SQL> SELECT * FROM Doctor;

DNO DNAME CITY
---------- --------------------------------- ----------------------
1 Sharma Pune
2 Varma Pune
3 Swami Delhi
4 Rashmi Mumbai

QL> SELECT * FROM Hospital;

HNO HNAME HCITY
--------- -------------------- --------------------
1 Sasoon Pune
2 Jehagir Mumbai
3 Rakshak Clinic Delhi
4 Budani Pune
5 KEM Patna

SQL> SELECT * FROM Dochos;

DNO HNO
---------- ----------
1 1
2 2
3 3
4 4[/code]
Feb 14 '12 #1
0 1446

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Martin Lucas-Smith | last post by:
Can anyone point me to a regular expression in PHP which could be used to check that a proposed (My)SQL database/table/column name is valid, i.e. shouldn't result in an SQL error when created? ...
8
by: Shino | last post by:
Hi, Can anyone help with this error: "ORA-00904: invalid column name"? Thanks! SQL> create view PPFa as 2 SELECT L.UserID AS LecID, U.Name, U.Email, I.IntakeID, S.UserID AS StudID 3 FROM...
7
by: Patrik | last post by:
Hi, Can we use a parameter that is a column name in a function ? Here's my function : CREATE FUNCTION dbo.fn_counting (@colnumber varchar(2),@number varchar(1)) RETURNS int AS
1
by: ae | last post by:
My datareader looks like this where dtrItemList is the datareader and chklExceptionList is my checkboxlist. the rows come in just fine, but I need help also including the name of the columns for...
4
by: JIM.H. | last post by:
Hello, string colVal =((TextBox)e.Item.Cells.Controls).Text; this is how I reach column value in a grid: how can I reach with the column name? some value should be int, some date, how should I...
3
by: Meena | last post by:
Hi Every Body, I have created a crystal Report and linked to my vb.net forms and working fine, I added more drill drowns in groups everything fine, but What I need is I am not able to display...
1
kaleeswaran
by: kaleeswaran | last post by:
hi! i want to display the database fields with the respective value... like , my table is:pay_allow_details. from that i have column name like :h_house_rent,hill_allow,risk_allow. so...
1
by: Big Moxy | last post by:
Problem URL - http://projects.zanalysts.com/ariviewer/display.asp?ID=11 I'm using Access as the "database". I get this error in the above URL: ADODB.Fields error '800a0cc1' Item cannot be...
0
by: Sebastijan | last post by:
Hi I am interested in DbConnection.GetSchema method of ODP.NET oracle library. When I call (to get primary keys metadata) DataTable pkeys = DbConnection.GetSchema("PrimaryKeys"... foreach...
2
by: meenuchotijuhi | last post by:
Hi, I've Recently joined this community coz i m very much interested in Oracle DBA track. Actaully I' m currently working on a project where I m using Java (jdk1.4) as front end and Oracle 9i as...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.