473,779 Members | 2,015 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1782
"leegold2" <le******@veriz on.net> wrote in message news:l6OBc.2104 9
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_n ame, 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
2517
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 have a separate data adapter & a separate data set for each select query? If thats possible then how?
3
4591
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 questions: -Concerning that array why is texID used? terrainTex doesn't state the first element? What does terrainTex represent? Especially the "0". -How do i transfer terrainTex back to the calling terrain.cpp. the
2
4729
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 ' begin if $1 is null then return $2; else return $1;
9
1704
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 greatly appreciated. TIA
0
2072
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 data into a comboBox. One thing I noticed, however, is that this method shows me both the parameters used by the main report and parameters used by the sub-report(s).
38
3489
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 similar to innerHTML property eg. (my guess) setInnerNodeAsText or sth... ? I want to write function which will be dynamically updateing some of my select boxes. My question is: (2.1) Can i use innerHTML property of SELECT (or even incorporate
4
6066
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 just want to implement it because they want to learn it?. But any new technology becomes useful if it is useful to the user. And Ajax is one of the technologies which will be useful as it really
14
4114
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 as "Static
0
1214
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
9636
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9474
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10306
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9930
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7485
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6724
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5373
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5503
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4037
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.