I have a sql table called “users” inside this table a column named “Cities” has array in it (1,2, 3,…) row1 :”1,2,15,69,98″ row2 :”7,9,15,5,69″ row3 :”7,3,1,5,6″ how can I select rows which …
Tag: mysql
Housing Society management system database structure
I am designing billing structure for housing society yesterday I googled and gone through banking billing structure and designed my database structure but I am not sure whether this would be correct. So I am putting my billing database structure. Please tell me if I am wrong any where or any changes has to be done in my database structure.
Creating tables in InfluxDB via Terminal
Are there tutorials online that teaches you how to create tables and input values in InfluxDB? How would you create a table and insert values into them? Answer InfluxDB doesn’t really have the concept of a table. Data is structured into series, which is composed of measurements, tags, and fields. Measurements are like buckets. Tags are indexed values. Fields are
Sql returns empty row on combinning primary key with another value in where clause
I am getting empty row on following sql SELECT * FROM flyers WHERE fId=’6′ AND ‘userId’=’400’ MySQL returned an empty result set (i.e. zero rows). (Query took 0.0004 sec) But when i use SELECT …
How to Update new tables inside another update query?
I have a legacy system and i have a php file inside of it, updating one table. Now i added a new table to my db and i want to update that table too. The problem is that (for some reasons) i cannot use another query and i have to change the current query. simplified former query: $q = “UPDATE
One table with many field or two table with fewer fields?
My question is simple, currently, I have a database with an “User” table which contains important information about each users (email, username, password), an “Identity” table which contain the first name, last name, birthday… of an user, and a “Medias” table which currently contains fields like “facebook”, “googlePlus”, “twitter”, “youtube”… the address of all medias of the user actually. But,
Optimize GROUP_CONCAT in SQL on MySQL
Is there a way to get the following SQL optimized so it would run faster? I encountered the bottleneck are the GROUP_CONCAT’s but I couldn’t find a way by using an alternative or optimizing the query so it would run faster. At the moment the query needs about 3.2s on 2700 entries (mysql database 5.1.73, mysqli). All tables have indices
How to run SQL queries in a loop
How can I run this SQL query multiple times in a loop, where I replace the word ‘pubs’ with another word during each iteration. Is there a way to store an array of strings and loop through them? Answer In general, it’s usually better performance-wise to do bulk or batch queries than queries in a loop, since you can save
Which is faster in sql: searching for a table, or searching for data in table? [closed]
Say there are 1,000 tables in a database, and each table has 1,000 rows. When I search for single table from these 1,000 tables, is the search time same as that required to search for data within one …
MySQL to fetch all the records based on a month of a year
I have a table and in that table there is a column called date_created, which is in TIME STAMP format 2016-07-20 11:30:15 and while I am fetching record I have to pass only the month and year in my front-end field like (month_no/year) 1/2016, 2/2016, 3/2016….. So I have to fetch all the record based upon a month. So how