I have value like this stored in value.txt file I have created table in the below way I am unable to find a way to insert the txt file details in payload columnn of table. I saw load option is there but it is more of entire table oriented. I want the txt files value to be in specific column.
Tag: sql
In MySQL, query of a word also matches words with special characters
The following query is supposed to match all comments containing ‘testa’, but it matches ‘testä’, as shown below: How to do an exact match only for the string ‘testa’, so that it doesn’t show results for its matching special character? Answer I think I have a solution…
PostgreSQL join table on json property and get oldest first from result with nulls first
I got 2 tables; domains and events. Im trying to create a query that returns a list of distinct domains that is ordered by the oldest events (for that domain) with nulls first and distinct domain. Basically this query will do the job: But the output is not distinct on ‘domain’. When using ‘d…
Rails: Finding records where a nested association is empty
In a Rails application I’m working on, I’ve got a few different models associated like this (condensed for clarity): group.rb group_member.rb newsletter.rb newsletter/author.rb newsletter/story.rb Given the above associated models, here’s the framework I’m working within: Each Newslett…
MySQL – Sum revenue while correcting by daily exchange rates
I have two tables Orders table Exchange rates table (cron-job does the job for this) I have to sum the orders total in USD and with the correct exchange rate! How could I achieve that? Is there a common practice? What I have so far is a basic sum: Answer The link you need is that based on the date.
Oracle query, get count of records by hour
I am trying to get transaction counts for every hour. Normally it is a straight forward query by unfortunately the timestamp column I have to work with is not timestamp but varchar2! No matter what I try I get either “not a valid month” or “invalid number”, depending on the format I us…
Obtain Name Column Based on Value
I have a table that calculates the number of associated records that fit a criteria for each parent record. See example below: note – morning, afternoon and evening are only weekdays What I am trying to achieve is to determine which columns have the lowest value and get their column name as such: Here i…
How to ignore 00 (two leading zeros) in Select query?
I am not sure whether it is possible or not, I have one DB table which is having fields refNumber, Some of this fields values contains two leading zeros, following is example. id. refNumber 10001 123 10002 00456 Now I am trying to write a query which can select from this table with our without leading zeros (…
How to find the sum from value of sql column
I have two tables with following data. studenttbl: feetbl: I need to find below data, but I am not getting balance value of seatno 1006: I am using this SQL query: Please help me with this. Answer This issue is due to INNER JOIN versus LEFT JOIN. When you INNER JOIN youll only get matches between two tables. …
Why does oracle DBA_SYS_PRIVS have more grantees than are in USER_SYS_PRIVS and ROLE_SYS_PRIVS?
So I was trying to figure out whether a grantee in DBA_SYS_PRIVS was a user or a role. When I search for it in DBA_SYS_PRIVS, it’s there: Which gives me: So then I wanted to know whether GRANTEE1 was a user or a role, so I did these two queries: and and neither of them showed any results. So then