Probably considered trivial so there may not be a way of doing this, even if there is it is probably easier to
Either - Convert the file
executables like unix2dos
one liners like perl, awk
write your own
ftp
Or - better still use a better editor
paid for - uedit / editplus
free -...
Matching records is what a database does so your approach to read a line from a file then form a sql query, submit the query, read the result is a bit of long way around.
Depending on the relative size of the fopen file vs the database table
Either
load your file (that you were reading line by...
I cannot see any reason this would not work... but sounds suspiciously like a permissions problem ... may be the way you are approaching this.
The location of the database files is controlled by a variable that can be set in the my.cnf or on the command line ... look for datadir=. So while...
DonQuichote
>>Now this is funny. MySQL knows that two indexes can be used and uses neither of them!
I think this is to be expected the indexes may well be larger than the data so scanning the table is probably easier than using the indexes.
Interesting problem...
First indexing might not always increase speed of access..
You should consider using partitions...
Not sure there is an easy answer other than trying a few different approaches....
You may notice that simply scanning the full table works pretty well.
You say your data...
Yup this is the right approach.
You might want to consider setting up a special user who only has specific rights on specific tables from a specific host rather than use root.
You could set up a simple script with the mysql command in that cron calls and then chmod the file to restrict access.
You need to create a sequence number then use this to group into sets of 2. There are a couple of ways of generating a sequence number either use auto_increment field or use a variable and increment it yourself @counter:=@counter+1
This means you can do something like this
drop table if...
You really need something like regexp_like not available in regular MySQL but various flavours available as udf's try
http://udf-regexp.php-baustelle.de/trac/
Mufasa
Many thanks great that answer is so simple - I thought I would have a problem generalising this to be any number of columns
meanof(col1,col2,col3)
meanof(col1,col2,col3,col4)
so was thinking I would have to pass in a string that I then parse it.
Thanks for sticking with me.
Thanks Mufasa
Realise my original post was not very clear. Yes want to do something very similar but rather than pass in constants to the function 2,4,6 I want to pass in column names col1,col2,col3
so
select * from mytable
returns
col1,col2,col3
2,4,6
6,8,10
select meanof(col1,col2,col3)...
I am trying to write a function that will take the average of a number of columns (rather than average of column in a number of rows)(trying to ghost a SAS function called mean)
select
meanof('var1,var2,var3')
from mytable
on data (var1,var2,var3)
2,4,6
6,8,10
would return...
if your column year is defined as having NULL then you would just go
INSERT INTO TABLE (firstname, lastname) VALUES ('$_POST[firstname]','$_POST[lastname]');
and the value of year would be [NULL]
(you should really think of a better name than year which is probably a reserved word)
Yes
The example config files have some explanation of what they are. Assuming you are running a simple server the main section to look at and understand is [mysqld] and within this check the basedir datadir tmpdir point to the correct directories.
No experience of Fedora all distros are slightly different in where they put things and the RPM might have reflected that.
Would be surprised if there was not a my.cnf somewhere have you searched for it with find.
Suspect it might be the script that starts the server that is passing parameters...
What you need is reg expression and replace ...
not available in standard MySQL
Available as a UDF from
http://mysqludf.com/lib_mysqludf_preg/index.php#PREG_REPLACE_SECTION
Otherwise you are stuck doing something ugly like
if(ascii(substring(message,1,1)) between 65 and...
Dont worry it is straight forward... only complication is coming from the fact that you dont control the server it is hosted on
1.& 2. You need to complete a mysql command with ;
try no 1 again
3. I dont think is the way to go as you noticed phpmyadmin uses a temporary file - dont assume you...
ls -all only lists files in the current directory
cd to csvfiles and do again, you probably need something like ...
LOAD DATA INFILE "/kxxxxx/homepages/99/d1xxxxxxx8/csvfiles/employees.csv" INTO TABLE employee FIELDS TERMINATED BY "," LINES TERMINATED BY "\r\n";
grant is the mechanism for setting the various values in all the permissions tables
if you are using the mysql permissions system to control access to the database then this is what you should use
if you only wanted users to be able to select from one table (thetable) and not insert update...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.