473,609 Members | 1,868 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MySQL 4.0.15 vs. Oracle query ARRGH

Ahem..
Anyway, here's whats happening...

construct tables in MySQL:
DROP TABLE EMP;
CREATE TABLE EMP
(EMPNO INT(4) NOT NULL,
ENAME CHAR(6) NOT NULL,
JOB CHAR(9),
MGR INT(4),
HIREDATE DATE NOT NULL,
SAL DOUBLE(6,2),
COMM DOUBLE(6,2),
DEPTNO INT(2) NOT NULL);
DROP TABLE DEPT;
CREATE TABLE DEPT
(DEPTNO INT(2) NOT NULL,
DNAME CHAR(10) NOT NULL,
LOC CHAR(8));
DROP TABLE SALGRADE;
CREATE TABLE SALGRADE
(GRADE INT(1) NOT NULL,
LOSAL INT(4) NOT NULL,
HISAL INT(4) NOT NULL);
CREATE INDEX EMPNOIND ON EMP (EMPNO);
CREATE INDEX DEPTNOEMPIND ON EMP (DEPTNO);
CREATE INDEX DEPTNODEPTIND ON DEPT (DEPTNO);
INSERT INTO EMP
VALUES (7369,'SMITH',' CLERK',7902,'19 83-06-13',800,NULL,20 );
INSERT INTO EMP
VALUES (7499,'ALLEN',' SALESMAN',7698, '1983-08-15',1600,300,30 );
INSERT INTO EMP
VALUES (7521,'WARD','S ALESMAN',7698,' 1984-03-26',1250,500,30 );
INSERT INTO EMP
VALUES (7566,'JONES',' MANAGER',7839,' 1983-10-31',2975,NULL,2 0);
INSERT INTO EMP
VALUES (7654,'MARTIN', 'SALESMAN',7698 ,'1983-12-05',1250,1400,3 0);
INSERT INTO EMP
VALUES (7698,'BLAKE',' MANAGER',7839,' 1984-06-11',2850,NULL,3 0);
INSERT INTO EMP
VALUES (7782,'CLARK',' MANAGER',7839,' 1984-05-14',2450,NULL,1 0);
INSERT INTO EMP
VALUES (7788,'SCOTT',' ANALYST',7566,' 1984-03-05',3000,NULL,2 0);
INSERT INTO EMP
VALUES (7839,'KING','P RESIDENT',NULL, '1984-07-09',5000,NULL,1 0);
INSERT INTO EMP
VALUES (7844,'TURNER', 'SALESMAN',7698 ,'1984-06-04',1500,0,30);
INSERT INTO EMP
VALUES (7876,'ADAMS',' CLERK',7788,'19 84-06-04',1100,NULL,2 0);
INSERT INTO EMP
VALUES (7900,'JAMES',' CLERK',7698,'19 84-07-23',950,NULL,30 );
INSERT INTO EMP
VALUES (7902,'FORD','A NALYST',7566,'1 983-12-05',3000,NULL,2 0);
INSERT INTO EMP
VALUES (7934,'MILLER', 'CLERK',7782,'1 983-11-21',1300,NULL,1 0);
INSERT INTO DEPT
VALUES (10,'ACCOUNTING ','NEW YORK');
INSERT INTO DEPT
VALUES (20,'RESEARCH', 'DALLAS');
INSERT INTO DEPT
VALUES (30,'SALES','CH ICAGO');
INSERT INTO DEPT
VALUES (40,'OPERATIONS ','BOSTON');
INSERT INTO SALGRADE
VALUES (1,700,1200);
INSERT INTO SALGRADE
VALUES (2,1201,1400);
INSERT INTO SALGRADE
VALUES (3,1401,2000);
INSERT INTO SALGRADE
VALUES (4,2001,3000);
INSERT INTO SALGRADE
VALUES (5,3001,9999);
Based on identical tables (apart from obvious differences) in Oracle
SQL*Plus 8.

Oracle query entered:
SELECT ENAME, SAL, COMM
FROM EMP
WHERE JOB = 'SALESMAN' AND COMM > (5.0/100.0)*SAL;

Output on Oracle:

ENAME SAL COMM
------ ---------- ----------
ALLEN 1600 300
WARD 1250 500
MARTIN 1250 1400

This is the correct output.
MySQL query entered:
SELECT ENAME, SAL, COMM
FROM EMP
WHERE JOB = 'SALESMAN' AND C0MM IS NULL;

Output on MySQL:
ERROR 1054: Unknown column 'C0MM' in 'where clause'
As subject says, ARRRRRGH!

Thanks,
Asfand Yar

--
http://www.it-is-truth.org/

Jul 19 '05 #1
4 2102
Aggro wrote:
Asfand Yar Qazi wrote:
Ahem..
Anyway, here's whats happening...

construct tables in MySQL:
DROP TABLE EMP;
CREATE TABLE EMP
(EMPNO INT(4) NOT NULL,
ENAME CHAR(6) NOT NULL,
JOB CHAR(9),
MGR INT(4),
HIREDATE DATE NOT NULL,
SAL DOUBLE(6,2),
COMM DOUBLE(6,2),
DEPTNO INT(2) NOT NULL);


MySQL query entered:
SELECT ENAME, SAL, COMM
FROM EMP
WHERE JOB = 'SALESMAN' AND C0MM IS NULL;

Output on MySQL:
ERROR 1054: Unknown column 'C0MM' in 'where clause'

You have created a table with column name COMM (with o like outstanding)
and you are writing here "AND C0MM IS NULL;" ( where you are using 0
like 0,1,2,3,4,5...) ..

So replace the 0(number) with O(alphabet) and you should be fine.


Sorry, silly me...

--
http://www.it-is-truth.org/

Jul 19 '05 #2
Aggro wrote:
Asfand Yar Qazi wrote:
Ahem..
Anyway, here's whats happening...

construct tables in MySQL:
DROP TABLE EMP;
CREATE TABLE EMP
(EMPNO INT(4) NOT NULL,
ENAME CHAR(6) NOT NULL,
JOB CHAR(9),
MGR INT(4),
HIREDATE DATE NOT NULL,
SAL DOUBLE(6,2),
COMM DOUBLE(6,2),
DEPTNO INT(2) NOT NULL);


MySQL query entered:
SELECT ENAME, SAL, COMM
FROM EMP
WHERE JOB = 'SALESMAN' AND C0MM IS NULL;

Output on MySQL:
ERROR 1054: Unknown column 'C0MM' in 'where clause'

You have created a table with column name COMM (with o like outstanding)
and you are writing here "AND C0MM IS NULL;" ( where you are using 0
like 0,1,2,3,4,5...) ..

So replace the 0(number) with O(alphabet) and you should be fine.


Sorry, silly me...

--
http://www.it-is-truth.org/

Jul 19 '05 #3
Asfand Yar Qazi wrote:
Ahem..
Anyway, here's whats happening...

construct tables in MySQL:
DROP TABLE EMP;
CREATE TABLE EMP
(EMPNO INT(4) NOT NULL,
ENAME CHAR(6) NOT NULL,
JOB CHAR(9),
MGR INT(4),
HIREDATE DATE NOT NULL,
SAL DOUBLE(6,2),
COMM DOUBLE(6,2),
DEPTNO INT(2) NOT NULL); MySQL query entered:
SELECT ENAME, SAL, COMM
FROM EMP
WHERE JOB = 'SALESMAN' AND C0MM IS NULL;

Output on MySQL:
ERROR 1054: Unknown column 'C0MM' in 'where clause'


You have created a table with column name COMM (with o like outstanding)
and you are writing here "AND C0MM IS NULL;" ( where you are using 0
like 0,1,2,3,4,5...) ..

So replace the 0(number) with O(alphabet) and you should be fine.
Jul 19 '05 #4
Aggro wrote:
Asfand Yar Qazi wrote:
Ahem..
Anyway, here's whats happening...

construct tables in MySQL:
DROP TABLE EMP;
CREATE TABLE EMP
(EMPNO INT(4) NOT NULL,
ENAME CHAR(6) NOT NULL,
JOB CHAR(9),
MGR INT(4),
HIREDATE DATE NOT NULL,
SAL DOUBLE(6,2),
COMM DOUBLE(6,2),
DEPTNO INT(2) NOT NULL);


MySQL query entered:
SELECT ENAME, SAL, COMM
FROM EMP
WHERE JOB = 'SALESMAN' AND C0MM IS NULL;

Output on MySQL:
ERROR 1054: Unknown column 'C0MM' in 'where clause'

You have created a table with column name COMM (with o like outstanding)
and you are writing here "AND C0MM IS NULL;" ( where you are using 0
like 0,1,2,3,4,5...) ..

So replace the 0(number) with O(alphabet) and you should be fine.


Sorry, silly me...

--
http://www.it-is-truth.org/

Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
31380
by: Jack | last post by:
Hi All, What is the PHP equivilent of Oracle bind variables in a SQL statement, e.g. select x from y where z=:parameter Which in asp/jsp would be followed by some statements to bind a value to :parameter I dont like the idea of making the SQL statement on the fly without binding parameters as I dont want a highly polluted SQL cache.
3
2262
by: Zaphod Beeblebrox | last post by:
As much of this question relates to mysql, it may be OT? I'm trying to make a search engine for a reasonably complex database that was originally developed by someone else in Access. I've ported the data to mySQL and am reasonably happy with everything except the performance I'm getting from queries with multpile joins. Although the database is fairly complex, it's not very large (less than 2 Mb as an Access db, less than that in mysql...
4
9336
by: Mark Wilson CPU | last post by:
A colleague has written a prototype program in PHP, using a MySQL database. It's a relatively simple app, with a restricted set of mysql commands used (see below). The MySQL DB is being replaced with an Oracle DB (same schema). My plan 1) globally replace the few mysql commands with intermediate equivalents (such as myDB_connect for mysql_connect) 2) those central functions would then (for now) call the original mysql function to prove...
2
437
by: Asfand Yar Qazi | last post by:
Ahem.. Anyway, here's whats happening... construct tables in MySQL: DROP TABLE EMP; CREATE TABLE EMP (EMPNO INT(4) NOT NULL, ENAME CHAR(6) NOT NULL,
133
8995
by: jonathan | last post by:
hey all, I realize that this question might pop up from time to time, but I haven't seen it a while and things might of changed, so - Right now (July 2004) how does mysql stand up in comparison to oracle? We are seriously considering migrating our multi-processor oracle system to mysql to save on licensing costs, and would need several features that mysql may or may not have:
1
2542
by: Cern | last post by:
Is it somebody out there who has made a migration from an Oracle server to an MySQL server?? The scenario is as simply: I've got a Oracle 8 server with a database with content that I want to transfer to a MySQL database. No special data, constraints etc that MySQL not will handle. My solution is to reverse engineer the database from ERStudio and then produce a SQL script that will insert the data into the MySQL engine. But I can't do...
1
5611
by: JBBHF | last post by:
Hi i'm working on a web project, and i would like to make my oracle query work in mysql. select match.numero "nummatch", to_char(match.datematch, 'yyyy-MM-dd') "datematch", p1.numjoueur "j1", p2.numjoueur "j2", po1.p1 "m1p1", po1.p2 "m1p2", po2.p1 "m2p1",
4
2849
by: hot.favorite | last post by:
Hi, I'm fairly new to Python so please pardon any dumbness on my part. I plan to write an app in Python that will run on Linux and would need to connect to Oracle and MySQL. I could use MySQLdb for MySQL and cx_oracle for Oracle, but 2 different APIs in the same app is kind of painful. So I have unixODBC that gives me ODBC on Linux. The best ODBC access
39
8391
by: Mairhtin O'Feannag | last post by:
Hello, I have a client (customer) who asked the question : "Why would I buy and use UDB, when MySql is free?" I had to say I was stunned. I have no experience with MySql, so I was left sort of stammering and sputtering, and managed to pull out something I heard a couple of years back - that there was no real transaction safety in MySql. In flight transactions could be lost.
30
2794
by: Einstein30000 | last post by:
Hi, in one of my php-scripts is the following query (with an already open db-connection): $q = "INSERT INTO main (name, img, descr, from, size, format, cat, host, link, date) VALUES ('$name', '$img', '$descr', '$user', '$size', '$format', '$cat', '$host', '$link', '$date')" or die(mysql_error()); And when the query gets executed i get back the following error:
0
8139
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8091
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8555
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6064
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4032
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4098
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2540
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1686
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1403
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.