473,326 Members | 2,182 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

DB questions about null and the text data type

General DB questions,

Why do we use null values? Why is it better than an empty field?
What would be a real life situation were nulls are important to have?

If I have a paragraph of text in a field of data type: TEXT. Can I
search in this field? Maybe i mean, could i use SELECT on a table
and get rows on the basis of a string or substring in the TEXT field?

Thanks,
Lee G.
Jul 20 '05 #1
2 1754
"leegold2" <le******@verizon.net> wrote in message news:l6OBc.21049
Why do we use null values? Why is it better than an empty field?
What would be a real life situation were nulls are important to have?
Well, I suspect they could have done without NULL. Here's one usage. Say
you have a table of schools, and a table of students which links each to
student to one school. If you run a query

select *
from schools
left outer join students on schools.school_id = students.school_id
order by schools.name, students.last_name, students.first_name

then you get a list of schools along with the students in each. If there is
a school with no students, then all columns students.* will be NULL.
If I have a paragraph of text in a field of data type: TEXT. Can I
search in this field? Maybe i mean, could i use SELECT on a table
and get rows on the basis of a string or substring in the TEXT field?


Yes. In any SQL you can use LIKE. Use % for the wildcard character.

select *
from T1
where T1.text like '%inside%'

In MySql, they also have regular expression searching. Check out the REGEXP
command.
Jul 20 '05 #2
leegold2 wrote:
General DB questions,

Why do we use null values? Why is it better than an empty field?
What would be a real life situation were nulls are important to have?
If I have a paragraph of text in a field of data type: TEXT. Can I
search in this field? Maybe i mean, could i use SELECT on a table
and get rows on the basis of a string or substring in the TEXT field?
Thanks,
Lee G.

Null really means empty.
Real Life Situation: In a numeric field where you need both zero and
null. Let’s say you are measuring temprature, zero would be a
temprature but null could mean that you have not taken a measurement
for that row.

You can substring search using LIKE (read in any sql book). You can
also do freetext search which is a lot faster for larger db’s, since
the text is indexed for substring searches.

--
http://www.dbForumz.com/ This article was posted by author's request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbForumz.com/mySQL-DB-nul...ict121588.html
Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbForumz.com/eform.php?p=405024
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: pmud | last post by:
Hi, I need to display columns in a data grid based on 7 different queries. Now I have 32 questions: 1. Is it possble to have 1 single data adapter with 7 queries & 1 data set or do I need to...
3
by: Michael Sgier | last post by:
Hello I want to replace a windows bitmap load function through an equivalent SDL function. I should extract the img height etc. and assign it to the terrainTex array. I've also three beginner...
2
by: Steve Crawford | last post by:
Having a requirement to change null into a certain value in a query I created a couple versions of an ifnull function as follows: create or replace function "ifnull" (text, text) returns text as...
9
by: pankaj_wolfhunter | last post by:
Hi, I need some clearance on the following questions: 1) Does LOAD command updates indexes defined for a table? 2) Is REPLACE option in the LOAD command a logged operation? Help will be...
0
by: Henry | last post by:
Using ideas provided by some of you I was able to figure out how to get the names of the parameters fields of a crystal report specified at run time. The code below just basically puts the...
38
by: Luke Matuszewski | last post by:
Welcome I have read the in the faq from jibbering about the generic DynWrite, but i also realized that is uses only innerHTML feature of HTML objects. (1) Is there a DOM function which is very...
4
by: shamirza | last post by:
4 9 6 18.ATLAS-AJAX Note: - As an IT professional it's useful to know what the difference is between Hype and usefulness. For instance if there is a new technology coming in many programmers...
14
by: shamirza | last post by:
Question Do ActiveX DLLs made in VB still need the VB runtimes on the machine? ________________________________________ Answer In a word, Yes. Visual Basic does not support what is known...
0
by: Nomen Nescio | last post by:
SQLITE Blob writing error wizard said: Yeah, no problem. We love SQLITE around here. You may need to include the header for unlink(). On a POSIX system, this would be unistd.h.
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.