Ask the Experts

Ask the Experts

Oracle and SQL

  • Select * from loc

    Suppose you have a table which has only two columns, namely locid (not primary) and place. In Oracle, which query should I run to get the output as above? Firstly I don't want to use any advanced feature of Oracle 9i. Is it possible using plain SQL ...  Continue Reading

  • Making a select statement faster

    I have created a table, Party, and in it there are two main fields, party_code and party_name, and around 2,500 records are available in it. I passed a select statement to select party_name and party_code, but it is too slow in Oracle. What do I ...  Continue Reading

  • "Select star" with column reformatting

    Let's say I have a data table that has columns A-Z and column C is for Date-Time. I want to see all of the columns in my table. When I do a "Select * from datatable" the return is the standard DD-Mon-YY. My question is, can I still use a Select *...  Continue Reading

  • Count consecutive years

    I am struggling with writing a query to count consecutive years from the current year. I do not want to use a cursor. There is no requirement for the dates to be 365 days apart, just that they have different years. Any thoughts would be appreciated.  Continue Reading

  • Copy a row to the same table

    I want to insert a new row in a table with the same row in the same table with a different primary key value. I think I can do it using a temporary table but is there any other way?  Continue Reading

  • Select columns as rows

    I have a table with four fixed columns, which have to be converted as rows in the SQL output.  Continue Reading