I’ve a very basic requirement that I did earlier but for now unable to resolve it. I’ve a table in database that stores in and out time as the following format: 8/18/2019 8:00:00 AM So what I want …
Tag: oracle10g
how to solve this query using union
Display id and name for salesmen along with id and category of products in a single table. Indicate the source of the row in result by adding an additional column TYPE with possible values as ‘S’ (Salesman) and ‘P’ (Product). Display all rows. I don’t how to add column “type” without using alter actual tables are Salesman Table Product Table
How can I use rank function to solve this?
I have this data: and I want to this result: So I ve tried this: but it did not solve my problem. How can I solve this issue? thanks in advance Answer DENSE_RANK not RANK:
How do I list all tables in a schema having specific column in oracle sql?
I have found the list of all tables using this query – But I need to list all the tables having column name starttime_date or starttime. Answer You could use USER_TAB_COLS view. For example, You could try,
How does order by clause works if two values are equal?
This is my NEWSPAPER table. When i run this query It gives this output But in Kevin Loney’s Oracle 10g Complete Reference the output is like this Please help me understand how is it happening? Answer In relational databases, tables are sets and are unordered. The order by clause is used primarily for output purposes (and a few other cases
Deleting duplicates rows from oracle
I am using oracle database.I want to use duplicate rows from a table except one,which means that I want to delete all rows but atleast one row should be there. I have a table Now i want to delete duplicate rows but at least one row should be there. i had used this to find number of employees that are
How to calculate the slope in SQL
I have some data in a sql database and I’d like to calculate the slope. The data has this layout: I’d like the final output to look like this by creating a new table using SQL: To complicate things, not all Keywords have 3 dates worth of data, some have only 2 for instance. The simpler the SQL the better
Trigger created with compilation errors
I wrote this trigger to discount the top client in the database by 10% when a new purchase is made: However when i execute this statement i receive this message: Can someone please tell me what I am doing wrong? Thanks, Alex. UPDATE – Errors: Solution: Answer I don’t have your tables to hand so I can’t guarantee that I’ve
How can I round a decimal to the nearest even number in SQL?
I need to round a decimal in a sql query on Oracle 10g to the nearest even number. If the number is even, it should be returned. If the number is odd, the next even number should be returned. This is what I want: 8.05 should return 8.06, 3.48 should return 3.48 How can I do this? Thanks, Andrew Answer
(Oracle) How get total number of results when using a pagination query?
I am using Oracle 10g and the following paradigm to get a page of 15 results as a time (so that when the user is looking at page 2 of a search result, they see records 16-30). select * from ( …