I have 2 tables. users and users_meta. I want the query to return all users that have sexe=M and user_att1=1 (which should return only mathew) but I also need to be able to filter by other attributes …
Combine 2 tables without primary key
I have 2 tables and wanna combine as below Table Student: Student ID | Student Name ———–+————- 100 John 101 Micheal Table Subject: Subject Name | Subject Desc –…
Find Duplicates on Multiple Criteria
I have a set of financial transactions with a Date, Amount, Description and Source and I want to find transactions where the amount is the same, the date is within one day, but the sources are …
Using CASE WHEN DATE Statement in MariaDB 10.2.15
I created a query to display the ScanIn Field in one month on each date Code : SELECT Employee.Name, CASE WHEN DAY(LogsFormatted.DateIn) = 1 THEN LogsFormatted.ScanIn ELSE ‘-‘ END AS ‘1’, …
Fetching constraints in SQL database to JSON in PHP
Let’s assume I have the following database structure of car manufacturers and the corresponding cars: manufacturers: cars: The id column of manufacturers is the primary key and the manufacturer column of cars has the corresponding foreign key constraint. I’d like to produce the following JSON output using PHPs json_encode: To get the manufacturers and their founded_in I’d just perform: And
how to select non repeated date intervals?
My products table, year 2014 2013 2012 2011 2010 2009 2008 2007 2006 2005 2004 2003 2002 2001 2000 My Query, SELECT dt||’-‘||dt1 FROM (SELECT year as dt, year+4 as dt1 FROM products GROUP BY …
Update large table from smaller, mission critical, table without locking small table
In MySQL, I have two innodb tables, a small mission critical table, that needs to be readily available at all times for reads/writes. Call this mission_critical. I have a larger table (>10s of …
Will the constraints remain after Importing table from RDBMS to HIVE with sqoop?
When we use sqoop import to transfer an RDBMS table to HIVE, will the constraints of the table such as primary key remain ? i.e. will the column of the table which is the primary key remain as …
Joining in SQLite to get desired records
I am working on a mobile application which takes two inputs – Source Station Name and Destination Station Names. Upon receiving these two inputs, the application would then enlist the names of trains …
how to show empty value for a int datatype in SQL?
how to show empty value for a int datatype in SQL? I have a case statement on an int datatype column to show empty for the values less than or equal to 0. case when [TotalValue] <= 0 Then '' ...