SQL QUERY HELP [message #647361] |
Wed, 27 January 2016 03:16 |
|
arifs3738
Messages: 39 Registered: November 2015 Location: India
|
Member |
|
|
1)
From the below query i want my output to display first half in Upper & Second Half in Lower
SELECT UPPER(SUBSTR(ENAME, 1, LENGTH(ENAME)/2)) ||
LOWER(SUBSTR(ENAME, LENGTH(ENAME)/2+1))
FROM EMP;
Question:
If my string has 5 char like ('Bryan'), then i want the output as BRYan. Witht the above query i am getting the ouput as BRyan...Please help.
2)
From the below query if my table has 15 records i want 1st half , i.e. 8 Recrods in first table & the remaining in second table
SELECT ROWNUM, EMP.* FROM EMP WHERE ROWNUM <= (SELECT COUNT(*)/2 FROM EMP);
SELECT ROWNUM, EMP.* FROM EMP
MINUS
SELECT ROWNUM, EMP.* FROM EMP WHERE ROWNUM <= (SELECT COUNT(*)/2 FROM EMP);
But i am getting the output as First query gives me 7 recs & second query gives me 8 recs.
|
|
|
Re: SQL QUERY HELP [message #647362 is a reply to message #647361] |
Wed, 27 January 2016 03:22 |
John Watson
Messages: 8931 Registered: January 2010 Location: Global Village
|
Senior Member |
|
|
These are school homework questions, aren't they. You need to look up all the numeric functions, such CEIL.
And if you want to get good marks, do not use "record" when you mean "row".
|
|
|
Re: SQL QUERY HELP [message #647363 is a reply to message #647361] |
Wed, 27 January 2016 03:24 |
John Watson
Messages: 8931 Registered: January 2010 Location: Global Village
|
Senior Member |
|
|
I notice that you repeatedly raise topics with titles such "SQL help". This is stupid. It makes your questions effectively un-searchable. Please use proper titles if you want help in future.
|
|
|