In MySQL, Can I put a restriction like below at database level?
I need to make sure
1. a specific column can only take either 'true' or 'false' values.
2. and exactly only one row should be having 'true' value?
...
DELIMITER $$
DROP FUNCTION IF EXISTS `workplantype`.`FUN_STOCKINVENTRY_CHECK` $$
CREATE FUNCTION `workplantype`.`FUN_STOCKINVENTRY_CHECK` (
PONo1 VARCHAR(20),
PartCode1 VARCHAR(45)
) RETURNS bool
BEGIN
DECLARE diff bool;
set diff=false;
select if(Remaining_Quantity=0.00, true, false) as diff from tblstockinventory where PONo=PONo1 && P...
Hi, hoping you guys can help - I have a timestamp column in my db table and i want to run a query to find any records from that table where the timestamp is the same as 7 days from now (ignoring the hours, minutes and seconds). So far I have this but I'm certain it's not what i should be doing:
WHERE `import_date` = 'DATE_SUB(NOW(), INT...
i like to call the stored function in c#.i need articles and some examples for this
...
I have MySQL Table with an Order table in a DB this table has an auto-incremental id. Up-till now we have general numeric Order-ID likewise 1,2,3,4,5... From now onwards I have to append the series A20 to my id like A20103, A20104, A20105 and so on and when the last three digits reaches 999 the series appended should get changed to A2100...
Hi SQL experts,
I have problem with ORDER BY clause. When I remove ORDER BY in following query, query is finished in 0.004 seconds.
If I keep it, query is running very slow = 56 seconds.
It is because MySQL is first grabbing all 500 000 records, then sorting and finally returing only first 18 records.
How can I solve this big table ord...
I need to search some information through mysql query,so can I write and or together?If not then what is the procedure?In my query it will show the either any one of the field or more than one field,so how can i write the query?rit now i am writing like:-
$query="select * from fsb_profile
where profile_name = '".$_REQUEST['name...
From the examples that I have read and from the documentation on MysqlConnectionPoolDataSource at http://www.control.auc.dk/~04gr733/filer/javadoc-DB-driver/com/mysql/jdbc/jdbc2/optional/MysqlConnectionPoolDataSource.html it seems that Java SE applications cannot use connection pooling. Is this true? Can I get connection pooling to work ...
Hi guys, I am trying to get a users ID from a database within a class, but I have very little to no experience with classes, how could I go about getting the uid from the DB and then return the uid?
so basically something like this,
class hello {
public function getUid(){
//connect to the db
//get all of the users info
...
Hello,
With the query below, I am trying to overwrite the 10th field in a MySQL table called "login" with the value NEW_VALUE. It's not working. Is the code below the correct method for overwriting existing data in a MySQL table?
Thanks in advance,
John
INSERT INTO login VALUES (NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,...
Somehow I managed to get two indexes named user_id, as shown below. Should I drop, rename and rebuild one of them, or is this no problem?
SHOW INDEXES FROM core_item;
+-----------+------------+-----------+--------------+-----------------+-----------+-------------+----------+--------+------+------------+---------+
| Table | Non_uniq...
I'm trying to figure out an efficient way to join tables and cross reference with another table, with the reference looking to check that each record found in the join does not have a field which exists in the other table.
This is what I have so far - I somehow need to be able to make sure that each record's reg_no is not present in th...
Hi all,
I am using phpMYAdmin to set a URL as a Default Value to a Field of a Table in MySQL database, but of no luck.
The URL is like this one:
http://www.kaboodle.com/hi/img/c/0/0/b2/9/AAAADMEBXEUAAAAAALKWPw.jpg
Here is the Table field structure:
{varchar(255), utf8_general_ci, Not Null}
...
I have a that has a list of checkboxes and user can click any number then click submit. The list of checkboxes is generated based on the results of a mySQL query -
echo("<form id=\"target\" action = \"#\">");
echo("<ul>");
while($row = mysql_fetch_array($result) {
$the_value = $row['result_value'];
$the_label = $row['result_label'...
I want to create a MyISAM table in MySQL (tried various versions of 5.0.x and 5.1.x) which allows more than 2^32 rows. The way to achieve this is to get MySQL to use 8-byte instead of 4-byte row pointers.
Here's a quote from the MySQL manual:
If you build MySQL with the --with-big-tables option, the row limitation is increased to 1....
Hi guys
I have a question, how would I do the following?
I want to display a dropdown (html) with a list of language (english, french, etc.), ISO 639-1 codes. I want to display the language based on the native language (e.g., on the combo box, the "french" must say "francais" for the french speaking people to understand).
How I woul...
I'm trying to overwrite data in a MySQL table called "login." I want to replace a field called "website" with the variable $cleanURL. The code below is what I have tried to use, but the field just ends up blank / empty after I try to use it.
Any idea why this is happening?
mysql_query("Update login
SET website = $c...
I am using MySQL Connector/J (GPL licence) and bundle the jar as part of my distribution.
So should I need to release my application under GPL also?
...
I need to store reviews from different sources in table.
Fields:
'produtcId' char(14)
'user' varchar(128)
'Source' varchar(128)
'content' text`
Use cases:
Find all reviews for product
Insert or update review
I have troubles with case 2, because I need to find if review already exist (review with same produtcId,user and Source). ...
So below is my code. Where I'm having the issue is my bound text fields are not sending the information back to the UpdateCommand as expected. If I replace any of the @variables with hard coded text then the update occurs as expected. So if I replace @RegID with '25' then my record is successfully updated but blank as all other @variable...