in MYSQL how to get specific columns name for example:
i have following cols in databse
ID
NAME
ADDRESS
MOBILE
below query shows all the above columns name but i want to get all cols except ID and MOBILE.
SHOW COLUMNS FROM CONSIGNEE
Use WHERE to filter FIELD column
SHOW COLUMNS FROM CONSIGNEE WHERE FIELD NOT IN ('ID', 'MOBILE')
Related
I have a dataframe with two columns : ID and Demographic_distribution. ID is just a number (ex:123456). demographic_impression has a list for each ID. here's an example of what you get in the demographic_distribution column for one ID :
ID : 123456
Demographic_distribution : {"age":"25-34","gender":"male","percentage":2.6e-5},{"age":"13-17","gender":"female","percentage":0.000102},{"age":"13-17","gender":"male","percentage":0.000153},{"age":"65+","gender":"unknown","percentage":0.002118},{"age":"55-64","gender":"female","percentage":0.114114},{"age":"45-54","gender":"male","percentage":0.106534},{"age":"35-44","gender":"female","percentage":0.220674},{"age":"35-44","gender":"male","percentage":0.168249},{"age":"55-64","gender":"male","percentage":0.076748},{"age":"65+","gender":"female","percentage":0.086192},{"age":"45-54","gender":"female","percentage":0.152144},{"age":"65+","gender":"male","percentage":0.056202},{"age":"35-44","gender":"unknown","percentage":0.009239},{"age":"55-64","gender":"unknown","percentage":0.002552},{"age":"45-54","gender":"unknown","percentage":0.004952}
You can see that there are 5 age groups, 3 genders and many percentages. I would like to split the demographic column into three different columns for each parameters. Let's not forget that these informations are liked to an ID in each row, otherwise it doesn't make sense. I tried .explode, but it didn't work.
Any idea how to do this ?
I have a table with four columns namely core,domain, Prog_StdName, LP_Prj_Desc.
I want to retrieve unique the data, where LP_Prj_Desc column is dependent on Prog_StdName and Prog_StdName is dependent on domain, and domain, is dependent on `core.
Below image which Ihave tried using the select statement.
SELECT `core`,`domain`,`Prog_StdName`,`LP_Prj_Desc`
FROM `cf_ls`
WHERE `core` <> 'PS'
this show the duplicate rows enter image description here
Actually I need to retrieve the data like below imageenter image description here
SELECT distinct `core`,`domain`,`Prog_StdName`,`LP_Prj_Desc`
FROM `cf_ls`
WHERE `core` <> 'PS' ;
Try this one
I have a table ML, with column Klubs:
I want to split this column so I have two columns like this. New table name ML2 and column name Region.
First column can have 2 words if they are different from 2nd column word.
I am new to MySQL and searched all over stackoverflow and internet , but no luck.
How can split column Klubs from table ML as in 1st picture into new table ML2 with 2 columns as in 2nd picture?
Assuming that your second column does not include any spaces, we can search for the location of the last space, and then split there:
SELECT Klubs,
substr(Klubs, 1, char_length(Klubs) - instr(reverse(Klubs),' ')) as Region,
substr(Klubs, char_length(Klubs) - instr(reverse(Klubs),' ')+2) as Club
FROM ML;
I search for the the space with instr, and to do this reverse I use the reverse function on the string first, and then to compensate I subtract it from the length of the string with char_length.
You could insert it in a new table (ML2):
create table ML2
<the query>
or create a view:
create view ML2 as
<the query>
I have a library database. There are some kind of data (books, magazines and etc.).
I have a form on base of report of these data. In this example I'm trying to add in combobox just one value - Name of the book. I'm doing it by such a query in row source of the combobox:
SELECT [Forms]![books_list]![name] AS id;
books_list - the name of the form and name is the text box called name.
It returns only the first name of the book in all comboboxes - 123.
I need to show only these name values in different comboboxex, which has reference by the row.
To make it clearer - in first combobox - 123, second - Прошлое, third - May be next time.
As I understand, you want to take the value from the text box name, and use a query to select the same value in the combo box?
SELECT <insert your column name here>
FROM <insert your table name here>
GROUP BY <insert your column name here>
HAVING ((<insert column name here>)=[Forms]![books_list]![name] AS id);
I have a table name Vouchers in which i have three columns named "GroupName","LedgerName" and "Amount".
I have another Table named Accounts in which i have two columns "Name" and "Amount", now i want the column "Name" to have the the GroupName from the Vouchers Table and then all the LedgerName that have same GroupName to fall under that Record. The images explain my question asked above
Isn't this ORDER BY operation??
I don't think you can get your result in that format. But using ORDER BY operation you can get a similar output but with an extra column. :)