473,394 Members | 1,752 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,394 software developers and data experts.

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,'1983-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','SALESMAN',7698,'1984-03-26',1250,500,30);
INSERT INTO EMP
VALUES (7566,'JONES','MANAGER',7839,'1983-10-31',2975,NULL,20);
INSERT INTO EMP
VALUES (7654,'MARTIN','SALESMAN',7698,'1983-12-05',1250,1400,30);
INSERT INTO EMP
VALUES (7698,'BLAKE','MANAGER',7839,'1984-06-11',2850,NULL,30);
INSERT INTO EMP
VALUES (7782,'CLARK','MANAGER',7839,'1984-05-14',2450,NULL,10);
INSERT INTO EMP
VALUES (7788,'SCOTT','ANALYST',7566,'1984-03-05',3000,NULL,20);
INSERT INTO EMP
VALUES (7839,'KING','PRESIDENT',NULL,'1984-07-09',5000,NULL,10);
INSERT INTO EMP
VALUES (7844,'TURNER','SALESMAN',7698,'1984-06-04',1500,0,30);
INSERT INTO EMP
VALUES (7876,'ADAMS','CLERK',7788,'1984-06-04',1100,NULL,20);
INSERT INTO EMP
VALUES (7900,'JAMES','CLERK',7698,'1984-07-23',950,NULL,30);
INSERT INTO EMP
VALUES (7902,'FORD','ANALYST',7566,'1983-12-05',3000,NULL,20);
INSERT INTO EMP
VALUES (7934,'MILLER','CLERK',7782,'1983-11-21',1300,NULL,10);
INSERT INTO DEPT
VALUES (10,'ACCOUNTING','NEW YORK');
INSERT INTO DEPT
VALUES (20,'RESEARCH','DALLAS');
INSERT INTO DEPT
VALUES (30,'SALES','CHICAGO');
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 2090
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
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...
3
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...
4
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...
2
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
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...
1
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...
1
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",...
4
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...
39
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...
30
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',...
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: 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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.