Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    MYSQL


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Setting Cols To NULL By Default


For a developer who's making MySQL tables strictly for website content, and who is very confident that his PHP site will unerrorneously integrate with that database: should he make his columns NULL by default or no?Currently the code overlooks empty sets, cells, etc. where necessary; like I said, unerroneous.Right now it's just an issue of being technically correct, if you will. Never cared to set default values.NULL or NOT NULL ?




View Complete Forum Thread with Replies

Related Forum Messages:
Runlevel Setting On Default Rpm
We were affected by the power outage last week and I think people should
be aware - I'm not sure if it's fixed (I'm virtually certain it is not),
but the default rpm install of 4.0.12 has mysql starting up in runlevel
4 only. When our power was restored, RedHat went to runlevel 3 and
mysql never started on its own.To find out if you are affected run:

/sbin/chkconfig --list mysql

Then, run:

/sbin/runlevel

If chkconfig shows the 3:off and runlevel shows N 3, then mysql will not
start on its own. This is probably because I don't have X running by
default on the DB machine. I consider this a good thing.
To rectify the situation:
/sbin/chkconfig --level 3 mysql on

View Replies !
Setting Default Values
I'm trying to set some tables in mysql and I was wondering if you could set default values for each of the columns and how.

View Replies !
Column Default Value Setting
I've got a column called 'articleheader' in a table called 'article'. It currently has a default value of NULL, but i want to set it to default to "(none)" (without the double quotes). I have tried searching to find a solution but everytime I try the posted "solutions" I get an error.

I think it is because I don't specifiy the type of column it is or something.

View Replies !
Setting DEFAULT Value After Creation Of Field
I've been searching all over w3schools to no avail.

I have a column whos domain is varchar(6). I want to set the default value to 'active'. I already have a whole lot of values in there. Some are 'active', some are 'closed'. I just figured it would be nice to have a default value in case someone added an entity and didn't specify this particular field.

So, how do I set the default value for a column after I've already created and populated the dbase?
And are there any better resources on the web than w3schools?

View Replies !
Runlevel Setting On Default Rpm Is Wrong (in My Opinion)
We were affected by the power outage last week and I think people should
be aware - I'm not sure if it's fixed (I'm virtually certain it is not),
but the default rpm install of 4.0.12 has mysql starting up in runlevel
4 only. When our power was restored, RedHat went to runlevel 3 and
mysql never started on its own.

To find out if you are affected run:

/sbin/chkconfig --list mysql

Then, run:

/sbin/runlevel

If chkconfig shows the 3:off and runlevel shows N 3, then mysql will not
start on its own. This is probably because I don't have X running by
default on the DB machine. I consider this a good thing.

To rectify the situation:

/sbin/chkconfig --level 3 mysql on

View Replies !
Setting The Default Collation For A Specific Connection?
Is it possible to set the default collation for a MySQL connection? (I have MySQL 4.1.22)

I know you can use SET NAMES 'utf8'; for the character set, and can set the collation and character set for the whole server with my.cnf:

default-collation=UTF8_general_ci
default-character-set=UTF8

But is there any way to set the collation for a connection without editing my.cnf? Such that all CREATE TABLE queries and such on that connection automatically use utf8_general_ci as the default collation, rather than latin1_swedish_ci? (without adding DEFAULT CHARSET to each create table query)

View Replies !
When To Use NULL As Default Value
I pretty much set a fields default value to NULL if it not a "required" field in my app.

View Replies !
NULL Default Value
I have a simple table. I'm using phpmyadmin. As you can see my default values for NULL are 0 but for some reason wen a null value is posted to the database it appears as "NULL" instead of "0"....

View Replies !
Setting Null To Not Null How?
i have a mysql table.. (duh!)

a field in it is set to null and i want to unset it to make it not null.

how do i do that ? by default it takes null values (its weird.. default is null while null column is a no.. so it cant take null values!)

View Replies !
Lost Connection My Wait_timeout Is In Default Setting 28800
PHP/MYSQL) under UBUNTU 6.06. I keep on getting this error message "Lost connection to MySQL server during query" my wait_timeout is in default setting "28800". What else could cause this problem?

View Replies !
Binary NOT NULL Default
I've seen this used all over the place, not really sure what binary is used for.

View Replies !
Setting Date 0000-00-00 As NULL?
I'm working on little webapp where one field is set to MySQL DATE datatype. by default this will go to 0000-00-00 which is fine, so I'm wondering if it's possible to have a query that see if the value is the "0000-00-00" and return NULL.

select this, that, date FROM table .. if date = '0000-00-00' set date NULL ...

or something?

View Replies !
User Name Null And Socket Default
I installed mysql 4.1.11 in a linux workstation and started it new. I have 2 problems

1. socket defaults to /tmp/mysql.sock. <- How will I change the default socket to another directory where it actually resides.

2. When I enter in mysql, and do something the user name is forgotten and hence I get this error message.
(I tried with both --user option and without it.)

Access denied for user ''@'localhost' to database 'mysql'

When I work as a root user there is no problem.

View Replies !
Query Browser: Setting NULL Values
with a Query Browser resultset in Edit mode, how can the NULL value be set? If the word NULL is entered, it is interpreted as the string 'NULL'.

View Replies !
Error #1064 Near 'COLLATE Latin1_general_ci NOT NULL Default ''
I try to restore my wordpress (it's a php-based blog system) database on my remote webserver running MySQL 4.0.24. When I try to pass this SQL statement:

CREATE TABLE `wp_categories` (
`cat_ID` bigint( 20 ) NOT NULL AUTO_INCREMENT ,
`cat_name` varchar( 55 ) COLLATE latin1_general_ci NOT NULL default '',
`category_nicename` varchar( 200 ) COLLATE latin1_general_ci NOT NULL default '',
`category_description` longtext COLLATE latin1_general_ci NOT NULL ,
`category_parent` int( 4 ) NOT NULL default '0',
PRIMARY KEY ( `cat_ID` ) ,
KEY `category_nicename` ( `category_nicename` )
) ENGINE = MYISAM DEFAULT CHARSET = latin1 COLLATE = latin1_general_ci AUTO_INCREMENT =9

I got this error:

MySQL said:
#1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'COLLATE latin1_general_ci NOT NULL default '',
`category_nicen

I tried to replace ` with ' but this didn't work either. My local server is running on MySQL 4.1.15 without problems.

View Replies !
Value Of One Col To Be The Sum Of Another 2 Cols
so for exmple, if i write:

create table test (col1 int, col2 int, col3 int);

how do i make the default value of col3 to be the sum of col1 and col2? hence, whenever i insert a new record, i will only need to insert the values for col1 and col2, and the value of cal3 will be automatically calculated.

View Replies !
ENUM Cols
Upgraded to 5.0 and cannot SELECT enum_col_type FROM some_table;
mysql reports a syntax error in statement?

View Replies !
INSERT (cols) VALUES (...), (...)
INSERT INTO labResults (labType, labValueAM, labValuePM, retest, labTest, sampleDate, RxNumber) VALUES ('saliva', '0.00', NULL, NULL, 'Estriol', '2006-02-24', '8888888') ON DUPLICATE KEY UPDATE (labType, labValueAM, labValuePM, retest, labTest, sampleDate, RxNumber) VALUES ('saliva', '0.00', NULL, NULL, 'Estriol', '2006-02-24', '8888888');

That's what I'm trying to do, but I get a syntax error. What's wrong?

View Replies !
Creating Output Cols That Are Sums
This *should* be simple, but darned if I know how to solve it...

I have a simple table, looks like: .....

View Replies !
Exclude Double Cols In JOIN
I have two Tables:

-----------------
Workers
-----------------
Cols:
-----------------
ID
Name
AdressID
EditedBy
EditDate
-----------------
-----------------
Adresses
-----------------
Cols:
-----------------
ID
Street
Town
EditedBy
EditDate
-----------------

Now I JOIN this two and want to exclude the "Double" Cols: ID, EditedBy and EditDate.

How can I do this without writeing every single Col?

View Replies !
Join 2 Varchar Cols On A Limited Number Of Characters
Is is possible to join two varchar columns on a limited number of characters.

I'm comparing two address tables, and the same addresses entered could look slightly different. For example, an address could have been entered as 12345 Marina North Circle or 12345 Marina North Cir. or even 12345 Marina N Circle. A join on the first 7 characters would successfully return each of these as one related address.

View Replies !
MySQL 4.0.17 Data Scrambles, Not-null Fields Become Null, Etc.
I'm having the most bizarre problem with PHP/MySQL that I've ever
faced and it's an urgent matter (of course) to try to fix it ASAP.

We have one record inserted into a table with 75 columns, whereby half
of the columns are not-null, but for some bizarre reason, the fields
are null. The rest of the columns that are null are completely
scrambled (e.g. "first_name" is in "address2", "fax" is in "url", "url"
is in "last_name", etc.)

This just recently occurred and seems to have no history otherwise. It
occurred sometime on Saturday when the record was inserted but logs
indicate no unusual activity at that time.

Has anyone seen this before and found a way to prevent it from
occurring again?

View Replies !
Incorrect Integer Value: 'NULL' For Column Even If NULL Is Allowed
mysql> desc my_table;
+------------+---------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+---------------------+------+-----+---------+-------+
| id | varchar(19) | NO | PRI | | |
| value1 | int(11) | YES | | NULL | |
| value2 | int(11) | YES | | NULL | |
+------------+---------------------+------+-----+---------+-------+

I want to import data from a file that looks like this:
9bcd6f7b47a30fb8_01;NULL;NULL

With following command:
mysql> load data infile 'filename' into table my_table fields terminated by ';';

And get following error:
ERROR 1366 (HY000): Incorrect integer value: 'NULL' for column value1'' at row 1

So the system denies me importing NULL values into a field where NULL is allowed.

View Replies !
Is Null Clause Takes A Lot Of Time But Is Not Null Statement Not
i have a query which takes 1 and half minute to fully execute. This query is following which return 2 records

select o.id, o.number, o.timest, o.receiptno, o.canedit, o.sessionid, o.voidorder, o.cashchange,p.amount from orders o left join payments p on (o.id=p.oid) where p.amount is null

but if i remove the 'not' from where clause then it takes a fraction of seconds. query is following which takes fraction of second and it returns 3920 records

select o.id, o.number, o.timest, o.receiptno, o.canedit, o.sessionid, o.voidorder, o.cashchange,p.amount from orders o left join payments p on (o.id=p.oid) where p.amount is not null

View Replies !
Getting Null Values From A TEXT NOT NULL Field
I have created a table with a field labeled Description which is a TEXT field which does not allow null values. It's defined with

Description TEXT NOT NULL,

However, when empty strings are stored in the Description field, I get NULLs back when querying the database. I'm writing an ASP application which connects to the MySQL database through ADODB. The MySQL version is 5.0.45. The engine is InnoDB.

View Replies !
CREATE TABLE :: Null And Not Null
I recently created a new table in a database and wanted some fields to accept nulls (NULL) and others to not accept nulls (NOT NULL). The table was built correctly, however, when I went to edit a row in the Query Window of MySQL Browser it allowed me to enter in the row when the NOT NULL fields had no values attached to them - this should fail and stop me from entering a row.

Here is the script for the table I created;

CREATE TABLE SLG (
SLG_ID int(11) NOT NULL auto_increment,
SLG_CODE CHAR(1) NOT NULL,
SLG_DESCRIPTION VARCHAR(255) NOT NULL,
SLG_DATE_CREATED DATETIME NOT NULL,
SLG_DATE_MODIFIED DATETIME NOT NULL,
PRIMARY KEY (SLG_ID)
);

When I apply the changes in this window it just enters NULLS into all the other fields. Is this a Query Browser issue. I tried doing the same with an INSERT statement and received the same result.

Also - related to creating a table - is it possible to create global Defaults on a database and then reference those in the DEFAULT statement of the CREATE TABLE command. MS SQL has a system function that can be executed after a table is created to bind a global default to a specific column.

View Replies !
Insert Null To Not Null Column
I have build a replication environment in my environment. the master is MySQL 5.0.24a-standard-log and the slave is 5.1.30-log. the configuration is not the same between them.

I have found a replicaiton error in the slave today says: .....

View Replies !
NULL And NOT NULL Settings
I have a MySQL table that stores name and age of a person. The name field needs to have a value; the age field is optional.I'm quite confused now with the NULL and NOT NULL settings... It seems that neither one does what I want (rejecting an INSERT query where the name field is empty)...So what exactly do I have to do?

View Replies !
VARCHAR Null/Not Null
I'm having a problem with a table that is already created - I want insert attempts to FAIL when the column for 'firstname' is empty (a VARCHAR field). Currently, the column is set to Null=YES and a Default of 'NULL'. This allows records to be inserted with no 'firstname' value (NULL appears in the column). If I change it in phpmyadmin 'structure' to Null=NO and Default of [empty field] then it allows records to be inserted with no 'firstname', and 'firstname' shows empty in the column

View Replies !
PK Field Not Null Is Being Null
I m newbie. I made a MySQL database table and in the primary key field I set the data type VAR CHAR.I also set it not null .BUT still I can insert blank values in this PRIMARY KEY field. If I just blank my primary key field by this query- Insert Tablename Values ('','','','','',''); (if my table has 6 fields).HOW IS IT POSSIBLE. How can PK field allow blank value when I set not null. HOW TO SOLVE IT.

2. I use a MySQL GUI Tools from http://dev.mysql.com/downloads/. In Table viewer of Query browser, each time I insert the first field, it sets the datatype to INTEGER,NOT NULL, AUTO INCREMENT. But I change it to VARCHAR as needed. Do I have to/should use Integer type in PK field and can Varchar be incremented.

3.Can I set user privilege to a particular row (on a particular PK); HOW?

4. Is it correct/incorrect that the name of the foreign key has to be the same as the name of the corresponding PK. I saw that in MySQL I can easily change the FK name to anything else and then just make a reference of FK to the PK.

5. How can I make a one-to-one relationship in MySQL;

View Replies !
Setting Up An ISP
I am trying to figure out how to setup an ISP. I have
broadband in my shop and was thinking, I could setup the house to call into
my network and connect to the Internet through my DSL. I have servers with
Mandrake 10.1 for web/mail/ftp. Was wondering if this could be done and
what needs to be done for it to work?

View Replies !
Setting A New Value
I'm trying to design an internet forum these days ...
In my database i have got a field called (ID) which represents the id of the topics and i have assigned it an (auto_increment) attribute...
My problem is that when i delete all the topics from the forum and after that add a new topic to the database the (ID) of that new topic continues to increment from the last deleted topic,
so how can i set the (ID) of the new topic to 1 in case all the previous topics were deleted?

View Replies !
Setting Value
I have a table (cont_id) with an auto_increment primary key, and I had deleted entries with much higher numbers than others.Those entries are no longer there, but auto_increment sets cont_id based on the high-number entry I deleted.Is there a way to re-set auto_increment so it adds +1 to the highest-number value for cont_id among the existing entries?

View Replies !
Setting Sum
I need to get the sum from one table (table1) and update the second table(table2) based on 'id' field. Not sure what statement/function to use? .............

View Replies !
Setting It Up
I need help on setting mySQL 4.0 on my windows 2000 small business edition server. how exactly do i do it? its downloaded, and set-up, now how do i use it?

View Replies !
Setting Up
I am wanting to set mysql/php on my mac. Im wondering if installing mamp is the same as installing each component seperately. Can i get away with mamp or should i go through and set it up manually?

View Replies !
Setting Value Of Row_count()
i have a stored procedure consisting of several delete statements and i
want to be able to return the "Query OK, 0 rows affected" such that the
total number of rows deleted are summed up rather than returning the
number of affected rows of the last statement.

the number of rows deleted can be obtained through the ROW_COUNT() and i
can add it up. but how do i set the value of the "Query OK, XXX rows
affected"?

View Replies !
Setting Up Privileges
if I can restrict a user from a single table. I want him to be able to create,alter,delete all the tables but one, which I want him not to delete it, not to update it not to create it.Just to use
it. Can I do it? As long as I have read there is only the way to give credentials for all
the objects of the database.

View Replies !
Setting Value For All Records
How would i go about populating a new column based on an existing column
pluse a bit of text.

i.e i have a column fldID which contains numerics 1,2,3,4 etc and i want to
poulate a column fldIMAGE with values 1.jpg, 2.jpg etc.

View Replies !
Setting Max_connections
Where do I go to set the max_connections settings so I can have over
100?

View Replies !
Setting Up MySQL On Mac OS X
I'm a novice Unix user, and I can't get MySQL set up properly on my
Mac. It seems to have installed OK, but when I try to run the
mysql_install_ db script, I get errors. I can't set the root password
either that the documentation tells me to.

As background, I just want to use MySQL to work with databases and PHP
and HTML to set up web pages for database input and output. I'm running
MySQL on my own machine at home, and have no use for passwords or any
other administrative functions. I'm just looking to use the program to
set up and query databases.

Can anyone point me to a way to avoid all the UNIX admin stuff and run
the database? I can get in, but the mysql database doesn't appear when
I hit SHOW DATABASES as the tutuorial says, and I can't access or
create new databases. I think all this may have something to do with my
user account on my machine, but I'm not savvy enough to know how to
override permissions, be root, or any of that stuff. Any hints?

View Replies !
Server Setting
Is there any setting I can change to have an email of all MySQL errors sent to me?

View Replies !
Setting Constraints
I want to create a table and set a constraints on a fields. For example for the int field all the inputs has to be greater then 5.
How do I go about doing it?

I tried this
create table Foo(
id integer(5) not null, constraint id_range check(id>5)

View Replies !
Setting Heading To 1
i have a mysql table and i would like to set the heading gameType to 1 can this be done ?

View Replies !
Setting Input
I'm using Navicat to develop MySQL database. I have a table cutomer table that will be connected to Jsp page to collect data from the user online. I was wondering how do I set an input mask to the email address:
such as: abc@yahoo.co.uk into xxxxxx@yyyyyy.zzzzzz
So this means that the user must enter their email address in that format otherwise it should return a message saying INVALID.
Also another question was: Im trying to set my price field in such a way that it accepts values like 2.50
but i tried using Double, real, numeric, float but it does not allow the zero at the end.

View Replies !
Setting Position
is it possible to insert a row between 2 other rows in a table in mysql? how?

View Replies !
Setting Up MYsqL>
how would i install and set up mysql so i can run some forums off it using apache2?

View Replies !
Setting Up On XAMPP
This is how the server is started:

mysqlinmysqld --defaults-file=mysqlinmy.cnf --standalone --console

There's no "--old-passwords" but it's still not working.

I have Xampp, btw.
In my.cnf I took out the "old_passwords" declaration. I restarted the server a few times and it's still not working.

View Replies !
Setting Up Table(s)
I am creating a database for fashion designers. Each fashion desiger is an a table named "authorize" and have an id of "member_id".
The question comes in setting up the table(s) to enter their styles of work. I am at a bit of a loss of where to start.
A quick example would be there is a master category of shoes, under which there are sub-categories: (pumps, clogs, boots, athletic shoes, etc...)
*there will be other categories like clothes, dresses, etc.. which will of course of other subcategories.

The subcategories have styles (Toe Type, Color, Heel Type, etc...)

Each of the categories could be either men or women.
How would I set this up? Whould this be several tables, with several more lookup tables? Or could it just be one table with an id that ties each together? I know that somehow there would be a lookup table for the product to user.

View Replies !
Setting UpOnline DB
I am just about to start setting up an online database to show a list of clubs and the firms who help run them as volunteers.
A firm may run a number of clubs and a club may be run by any number of firms.
I was going to set up a table for the clubs with the usual fields (id, name, add1, etc) and a table with the firms (firmid, name, organiser, etc).
My question is, how do I link the firms and clubs? If it was a club only ever had a single firm I would just put the firmid in the club table, but as it could be any number of firms I am not sure how to structure it.

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved