Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
Database Design
»
Relational Theory
»
Divided Operator
Divided Operator
Rate Topic
Display Mode
Topic Options
Author
Message
ms65g
ms65g
Posted Friday, July 24, 2009 4:16 AM
Forum Newbie
Group: General Forum Members
Last Login: Thursday, January 21, 2010 12:29 PM
Points: 4,
Visits: 166
How do we implement DIVIDE OPERATOR in SQL?
Post #758915
stopitallready
stopitallready
Posted Friday, July 24, 2009 12:36 PM
Valued Member
Group: General Forum Members
Last Login: Friday, April 02, 2010 6:41 AM
Points: 54,
Visits: 134
What are you trying to do? More information is neccessary.
Eli
Post #759415
Jack Corbett
Jack Corbett
Posted Friday, July 24, 2009 1:11 PM
SSChampion
Group: General Forum Members
Last Login: Friday, May 17, 2013 12:22 PM
Points: 10,571,
Visits: 11,871
If you meant the math division operator then you use "/".
Jack Corbett
Applications Developer
Don't let the good be the enemy of the best. --
Paul Fleming
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
How to Post Performance Problems
Crosstabs and Pivots or How to turn rows into columns Part 1
Crosstabs and Pivots or How to turn rows into columns Part 2
Post #759451
ms65g
ms65g
Posted Friday, July 24, 2009 2:08 PM
Forum Newbie
Group: General Forum Members
Last Login: Thursday, January 21, 2010 12:29 PM
Points: 4,
Visits: 166
stopitallready (7/24/2009)
What are you trying to do? More information is neccessary.
Eli
I mean 8th operator. A divided by B per C
and A,B and C are result set.
A divided by B per C = A minus ( (A times B) minus C)
Post #759493
Lowell
Lowell
Posted Friday, July 24, 2009 4:54 PM
SSChampion
Group: General Forum Members
Last Login: Today @ 3:50 PM
Points: 11,645,
Visits: 27,735
still not clear to me either, can you give a non-pseudo code, concrete example of the expected results?
Lowell
--
There is no spoon, and there's no default ORDER BY in sql server either.
Actually, Common Sense is so rare, it should be considered a Superpower. --my son
Post #759548
David Webb-CDS
David Webb-CDS
Posted Friday, July 24, 2009 5:04 PM
SSC Eights!
Group: General Forum Members
Last Login: Today @ 3:19 PM
Points: 827,
Visits: 5,704
If you're talking about the relational division operator, a decent explanation with some SQL as an example is
http://www.dbazine.com/ofinterest/oi-articles/celko1
.
I'm not a big Celko fan, but this (and the included references) should get you started.
And then again, I might be wrong ...
David Webb
Post #759551
sqlvogel
sqlvogel
Posted Saturday, July 25, 2009 3:02 AM
SSC-Addicted
Group: General Forum Members
Last Login: 2 days ago @ 3:49 PM
Points: 406,
Visits: 2,852
Take a look at Vadim Tropashko's book
SQL Design Patterns
for examples of relational division problems and solutions.
Full marks for a good question by the way. It's a bit unfortunate that Relational Algebra and other relational theory ideas aren't as well appreciated and used in the SQL community as they perhaps ought to be. These concepts give you the tools and a vocabulary for solving lots of every day problems.
Unfortunately, as has often been noted, too many database practitioners today don't know the relational model at all. They just know SQL and someone once told them SQL was relational so they assume they must know the relational stuff too.
Not knocking anyone here BTW. Just my thoughts for this "Relational Theory" forum.
Hope this helps.
David
Post #759598
ms65g
ms65g
Posted Saturday, July 25, 2009 3:36 AM
Forum Newbie
Group: General Forum Members
Last Login: Thursday, January 21, 2010 12:29 PM
Points: 4,
Visits: 166
Thank you.
I agree with you. a lot of difficult problem solve by using relational algebra.
Dr. CJ Date offered two methods but I was looking for the best solution for division operator.
here is a method: Please exec following script before exec this query
-- My Method
SELECT DISTINCT pilot
FROM PilotSkills AS PS
WHERE NOT EXISTS (
SELECT plane FROM Hangar
EXCEPT
SELECT plane FROM PilotSkills
WHERE PS.pilot=pilot
)
/*
CREATE TABLE PilotSkills
(pilot CHAR(15) NOT NULL,
plane CHAR(15) NOT NULL,
PRIMARY KEY (pilot, plane));
INSERT INTO PilotSkills
SELECT pilot='Celko', plane='Piper Cub'
UNION
SELECT 'Higgins','B-52 Bomber'
UNION
SELECT 'Higgins','F-14 Fighter'
UNION
SELECT 'Higgins','Piper Cub'
UNION
SELECT 'Jones','B-52 Bomber'
UNION
SELECT 'Jones','F-14 Fighter'
UNION
SELECT 'Smith','B-1 Bomber'
UNION
SELECT 'Smith','B-52 Bomber'
UNION
SELECT 'Smith','F-14 Fighter'
UNION
SELECT 'Wilson','B-1 Bomber'
UNION
SELECT 'Wilson','B-52 Bomber'
UNION
SELECT 'Wilson','F-14 Fighter'
UNION
SELECT 'Wilson','F-17 Fighter'
CREATE TABLE Hangar
(plane CHAR(15) NOT NULL PRIMARY KEY);
INSERT INTO Hangar
SELECT plane='B-1 Bomber'
UNION
SELECT 'B-52 Bomber'
UNION
SELECT 'F-14 Fighter'
*/
Post #759600
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.