Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 7 months ago. The community reviewed whether to reopen this question 7 months ago and left it closed: Or…
Tag: sql
Converting a “DBML” file to a “SQL database file”
I have the DBML file of a database and would like to generate an SQL database file from this file. Thanks
How to get the difference between two dates rounded to hours
I’ll illustrate what I would like to get in the following example: Using TIMEDIFF(), we get 2 as a result. This means, it’s not considering the 50 minutes left. In this case, what I’d like to get is: 50 (minutes) / 60 = 0.83 period. Therefore, the result should be 2.83 and not 2. Answer
Query to group by maximum depth of PostgreSQL Ltree?
I want to query for all products with the name “Shania Twain”, but I want group them only by the tree with the deepest nlevel. Assuming I have a table like the following with the name categories So, for example, The problem lies with the HAVING clause requiring a boolean expression. The clause MAX…
What’s the R equivalent of SQL’s LIKE ‘description%’ statement?
Not sure how else to ask this but, I want to search for a term within several string elements. Here’s what my code looks like (but wrong): des is a vector that stores strings such as “Swinging Strike”, “In play (run(s))”, “In play (out(s) recorded)” and etc. What I wa…
Finding the actual Job number for a particular JDBC SQL connection to iSeries?
I am using the JTOpen JDBC driver to connect to the iSeries (aka AS/400, IBM System-i, IBMi, WTH?!…). I am having problems with a particular statement and it appears I need to go back to the actual SQL job QSQSRVR (or QZDASOINIT?) to find more details. Only problem is that there are hundreds of these on…
SQL: How to select 1st, 3rd, 11th and nth row from a table?
How to select 1st, 3rd, 11th and nth row from a table? Answer If there is a primary key defined for the table that is an integer based data type–both MySQL and SQLite have auto_increment for example–then you can use: …where id is the auto_increment column. There’s very little detail to…
MySQL create time and update time timestamp
I am creating some tables where I want to store the time when a record was created and when it was last updated. I thought I could have two timestamp fields where one would have the value …
How can I see the contents of an Oracle index?
Is it possible to have a look at what is there inside an index using SQL*Plus? If I have a table like this: Table A ———————— rowid | id name 123 | 1 A 124 | 4 G 125 …
Is a Primary Key necessary in SQL Server?
This may be a pretty naive and stupid question, but I’m going to ask it anyway I have a table with several fields, none of which are unique, and a primary key, which obviously is. This table is accessed via the non-unique fields regularly, but no user SP or process access data via the primary key. Is th…