Skip to content

Tag: sql

What is an on-disk structure?

An index is an on-disk structure. I couldn’t find anything understandable. For example, I found this Is it like a file system? Answer It just means that the index is physically stored on disk, as opposed to “only exists in-memory”. Your link is not related at all.

How to set default value in sql so that is displays in db

What important in A table is there are three values of type column: New, Activated, Archive. And I set default value 0 to size column of A table and after insert command I expected following result in A table: Query Table A result id b_id type size 1 101 New 10 2 101 Activated 0 3 101 Archive 0 But,

Using rownum in sub query on oracle 11

I have query like this.It is working properly on oracle 12. But I am using oracle 11.That query is not working on oracle 11.Therefore I changed my query like that It gives missing right paranthesis How can I solve this problem.Do you have any idea?Actually I use a variable instead on 10 number. Answer Syntax …

django get record which is latest and other column value

I have a model with some columns, between them there are 2 columns: equipment_id (a CharField) and date_saved (a DateTimeField). I have multiple rows with the same equipment_id and but different date_saved (each time the user saves the record I save the now date time). I want to retrieve the record that has a…

SQL Query return extra column depending of condition

I want to make a query which will add a column depending of what condition is meet(I have tried with sequelize without obtaining the result that I wanted) therefore I want to try with plain SQL because It does not have as many limitations. EXAMPLE: SELECT * FROM db.messages WHERE user_id = userID OR $contacts…

MySQL tree structure

Hello i am trying to prepare tree structure with MySql, tables look something like this. My Question is: Is it possible to do left join and sort columns by name, but if in lang is eq to “fra” return that row with that name, otherwise return “eng” name. Pseudo code So final result will …