Search Posts

Month: September 2017

Docker can’t connect to mariadb with PHP

I’m new to Docker and have been trying to figure out how I can connect to my MariaDB container with PHP with no success. I tried to search on stackoverflow and google but couldn’t find any useful info, so I am hoping you guys could help me out. The weird thing is that when I try to connect to MariaDB with JetBrains DataGrip with localhost, mysql, root, admin I can connect to the database but […]

MySQL help about CASE WHEN query

I am not sure what is mistake, i want to use CASE WHEN in SQL query, and where is 499 to say Country, for all else to put Test, but it gives on all result word Test, i don’t get it why, when in result i see 499? Can someone help me? SELECT SQL_NO_CACHE id, drzavljanstvo, ( CASE WHEN drzavljanstvo=( SELECT id_drzavljanstvo from drzavljanstvo WHERE id_drzavljanstvo=499) THEN ‘Country’ ELSE ‘Test’ END) location FROM bol_rac; Result […]

SQL join with 2 colummns with same name

I have created this query: SELECT * FROM arrangement, booker WHERE arrangement.arrangement_id = booker.arrangement_id AND arrangement.dato BETWEEN ‘2017-09-29’ AND ‘2017-14-10’ AND booker.dato > ‘2017-22-09 18:31:53’ AND arrangement.remind = ‘0’ Both arrangement and booker has a field called ‘dato’. I try to use the ‘dato’ from booker as parameter. I select ‘arrrangement.dato between’ that works fine then I select ‘booker.dato <‘ However, the ‘booker.dato <‘ fails and run in arrangement.dato when executing the query. Can anyone […]

dense rank partition error mariadb

I have a very simple query on maria 10.0.32 SELECT, v.ver, DENSE_RANK() OVER (PARTITION BY id ORDER BY id) AS dense_rank FROM v; I receive the following error: Check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘(PARTITION BY id ORDER BY id) AS dense_rank FROM v Source: Stackoverflow MariaDB

Auto-fill column on select

I'm pretty green to SQL so please forgive me if this is a very basic question. I just don't know what to google for, and everything I've tried searching for hasn't returned anything useful. I have 2 tables like this: Table 1 (devices): deviceId networkName deviceDesc deviceIp 10 aal_home pfsense01 11 aal_dc1 esxi01 12 ska_dc2 mgw01 13 aal_home pfsense01 Table 2 (networks): networkName defaultBoolean deviceCount aal_home true aal_dc1 false ska_dc2 false […]

Any tips for someone getting into RDMS and MySQL in particular?

Helly everyone, I am a college freshman looking to eventually become a data scientist. A recruiter at my university told me that MySql was a great tool to data scientists, and I was wondering if you could give me any tips that you might have liked to know when you were first starting. My goal this semester is to build some sort of turn-based game using MySQL. Thanks! submitted by /u/1CRK [link] […]

cron intervals

I don't really code much, but use crons to clean up data for my website. I have about 50000 records, and have 10 different mysql update queries that currently run every 15 mins. I'm using crons to run these via PHP scripts. One php file per query. These are no doubt dumb questions, but do i have to be wary of all the queries running at the same time, should they be staggered? Can I […]

Can’t secure MySQL (MariaDB) connection with SSL (mysql installed on NAS Synology)

A few question about MySQL (5.5.47-MariaDB – Source distribution) running on Synology NAS. I have build some application in C#, which is speaking with this mysql. It works fine. My problem is to make SSL Connection. I read, and read a lot of tutorials, mysql website etc. I think i understand conception: Create certs (with openssl.exe), put this files into mysql direcory (like etc/mysql ??), edit configuration files and convert this files from PEM to […]

How to find statistics of how many queries have run on my mariadb database?

I have a website that enables end users to search a Fulltext Index in mariadb database using terms that they input. The queries are like (select columnnames from tablename where match from tablename where match(column_names) against USER_input Using the results returned from that query, they can click on a result that returns a particular record (a row with several columns). How can I find out how many SELECT queries have been run on this database? […]

Next Page »