We have Oracle 11g so the following query didn’t work. select USERNAME,LAST_LOGIN from dba_users Then I searched and people suggested multiple ways and i got confused. What is the correct way to get …
Tag: sql
PostgreSQL LIMIT with OFFSET is not working beyond 100000
I am using postgres (9.6) docker for my project. After loading large volume of data, for example 234453, I need to cut data in chunks using limit and offset. But I have observed that my query is …
group by date and show the values of X(column) which depends on min time of that date and max time of that date in 1 row
I have table like I want to group by date which user has the id of u_id =1 and get first time and value of x and get the last time and value of x in same row it should be like what i’ve tried but i cant get the values of xs. the rows: Answer One method uses conditional
Using a Scalar Function that expects a Table Parameter inside an Apply block
TLDR: I have a scalar function, that expects a table-valued parameter and returns the XML representation of that table. Now I need to use this function in a larger Update statement, where the table-parameter of the function is generated by inner Select statements. Hi, We have an XML type definition, say [dbo]…
How to insert from old table to new table using trigger in pl/sql
There is a column which calls as text (column’s name) inside a table. I want to create different columns from this column. How to insert to another table these columns using trigger. I tried few …
Simple query to join with my booking table without duplicating records for each booking
I have a customer credit table and a booking table, shown below. I’ve executed the following query which works but it’s too simple. I now need to cross join my original query to the booking table so I can check for where the booking status is completed. My second query is wrong because it SUMs the…
Getting an empty result with ‘AND’ operation and wrong result with ‘OR’ operation in SQL
I have two tables and I want to find out the customer_id and customer_name of all customers who bought product A and B both. In this example only the customers with id 1 and 3 have bought both the product A and B. To find that i wrote this code – When I am doing this I am getting an
groupby to check each of their date in oracle sql
I have a table ISIN_TBL which has two fields IDENTIFIER and ALLT_DATE which are of datatype varchar and Date respectively. There are many ALLT_DATE for each IDENTIFIER in the table. Normally for each IDENTIFIER the ALLT_DATE should be the same. But just to confirm i want to write a sql query to list IDENTIFIE…
check for EMAIL format in ROW and return value inside SELECT query
I have a table called user_data and few columns like LOGIN_NAME The column LOGIN_NAME may contain “emailformat@email.com” or just a “username” I need to know if it is possible for me to run a select query and return emailAddress if row has email type format else return userName if it i…
How to do I query all distinct rows with only their highest values?
I have been trying to query each city’s popular genre. I am only trying to get the rows that I have highlighted. I tried using MAX() on a group by but gave me a syntax error. My CTE query is as follows, its based on the dbeaver sample dataset: I tried the following query. Answer I don’t have a dat…