Do You Have A Question On Sql?

A Member? Please Login  
type your username and password to login
Date: November 19, 2008, 10:06 AM
262568 members and 159896 Topics
Latest Member: ozziegbe
Nairaland [Nigerian Forum] Home Help Search Who is currently online? Login Register
Nairaland Forum  |  Technology  |  Programming (Moderator: Dual Core)  |  Do You Have A Question On Sql?
Pages: (1) Go Down Send this topic Notify of replies
Author Topic: Do You Have A Question On Sql?  (Read 350 views)
mat6plus
Do You Have A Question On Sql?
« on: December 10, 2007, 07:52 PM »

Do you have a question on SQL why don't you post them here and lets solve them together.
bobalalu (m)
Re: Do You Have A Question On Sql?
« #1 on: December 19, 2007, 10:47 AM »

Hi,

I don't know how to get any of d sql server installed on ma machine, and how to use it in developing a dbase that interact with a web application.

I hope u'll be of help to  me.


Obalalu Babatunde S.
Developer
+2348034627801, +2348026850072
my2cents (m)
Re: Do You Have A Question On Sql?
« #2 on: December 19, 2007, 03:30 PM »

mat6plus,

should I store text data as char or varchar?  Please provide reasons for whatever choice you suggest Wink
Syma
Re: Do You Have A Question On Sql?
« #3 on: December 20, 2007, 03:08 PM »

depending on how long the text data that u want to store. If you want to store a precise or small amount of text e.g. gender which will either be male or female use char(6). if male is stored in the column the remaining column will be filled with spaces. but if u want to store for example user name use nvarchar(30). For me if i am storing anyhting more than 256 characters, i use text as the datatype. examples, Gender: char(6), FirstName: nvarchar(30), email: nvarchar(256), MessageBody: text. Hope I help u.
Syma
Re: Do You Have A Question On Sql?
« #4 on: December 20, 2007, 03:12 PM »

Obalalu Babatunde S. What programming language do u use?
Gridlock (m)
Re: Do You Have A Question On Sql?
« #5 on: December 20, 2007, 03:38 PM »

@Syma

I just wanted to note, since gender is either Male or female, why not use M/F i.e. char(1). Or, even why not use a bit field i.e. int(1) ? Just a thot ,

@my2cents
I'm not quite sure i know if there is a difference between char and varchar
Bossman (m)
Re: Do You Have A Question On Sql?
« #6 on: December 20, 2007, 10:25 PM »

I agree. char would be more appropriate for gender.

The char is a fixed-length character data type, the varchar is a
variable-length character data type.

Because char is a fixed-length data type, the storage size of the char
value is equal to the maximum size for this column. Because varchar is
a variable-length data type, the storage size of the varchar value is
the actual length of the data entered, not the maximum size for this
column.

For example a char varChar will always take up 4 spaces to store the name Mike. While a char(20) will always take up 20 spaces to store the same thing, 


Quote from: Gridlock on December 20, 2007, 03:38 PM
@Syma

I just wanted to note, since gender is either Male or female, why not use M/F i.e. char(1). Or, even why not use a bit field i.e. int(1) ? Just a thot ,

@my2cents
I'm not quite sure i know if there is a difference between char and varchar
my2cents (m)
Re: Do You Have A Question On Sql?
« #7 on: December 20, 2007, 10:57 PM »

Gridlock, as Bossman has pointed out, there is a difference b/w char and varchar. 

I actually knew the answer.  I just wanted to see some discussion as my inbox has been kind of NL-dry lately, and I am happy I got it.  It's like, if I don't read anything from Nairaland, I go into bouts of depression  Cool

In the end, it's all about space taken up on your server and efficiency.

Syma
Re: Do You Have A Question On Sql?
« #8 on: December 27, 2007, 11:24 AM »

inbox me and i will give you what u want. symccord@yahoo.com
naijamark (m)
Re: Do You Have A Question On Sql?
« #9 on: December 27, 2007, 03:50 PM »

I downloaded this software as a trial version.
Now it refuses to uninstall, its like it install itself in d system registry, what do I do?
Guess it has smthing 2 do with sql
Thanx
obotutuoko (m)
Re: Do You Have A Question On Sql?
« #10 on: December 27, 2007, 03:58 PM »

OK - lets see who is a guru here.

I have a database with two tables, one table shows street names and the other table shows street names and also shows the postcode of each of the street, now i want to do a join on the tables, by writting an SQL query to create another table that will lok at the street name table, anywhere it finds a match, it should take the postcode from the other table and put it into the table of street names.

simple? it sounds so, but the problem is this, the street names in the two tables don't exactly match in all cases, e.g. you can have Ikorodu Road in one and also have Ikorodu Rd. in the other, or have street in one and have str. in the other. \how can a perfect join be done via a query?
Bossman (m)
Re: Do You Have A Question On Sql?
« #11 on: December 27, 2007, 04:45 PM »

Well, for the join to work efficiently it's important that the fields you are joining on match in all tables that are used in the join. If they do not match, as is the case here, you will not be able to use that column as the join field.  Usually you want to do a join on a key/unique field. Trying to do a join on inconsistent street names is not going to work.
samm (m)
Re: Do You Have A Question On Sql?
« #12 on: December 27, 2007, 06:47 PM »

Like the other posters indicated, your data has to be consistent for a join to work.  However,  inconsistencies are common when it comes to dealing with data.

The best solution is to handle each inconsistency programmatically.  My suggestion:

Use a replace function in the join (replace all st. to street and all rd to road)


replace([addressfield],'rd','road')


and do the same for str.

Let me know if you need more help on this.  Also, what kind of DB are you using?
shinzo abe
Re: Do You Have A Question On Sql?
« #13 on: January 01, 2008, 08:44 PM »

Oga,

I am having this problem: I know that Microsoft Access can prresent data in Forms and Reports [it makes it more graphical and beautiful].

I want to know if SQL can do that as well, because I have something to do with SQL and I have to display the data in forms.

Please answer as fast as you can!
Bossman (m)
Re: Do You Have A Question On Sql?
« #14 on: January 01, 2008, 11:33 PM »

SQL is just that, Structured Query Language. You can present the data using forms, reports, etc. As Microsoft has made capable with Access. Behind those forms, reports, is SQL. So, if you need to do something similar, you have to use an application that will serve as the front end/presentation layer to the SQL in the back. Some database vendors ship the appropriate tools with their products, as is the case with Microsoft Access etc. Hope you get the point. 

Quote from: shinzo abe on January 01, 2008, 08:44 PM
Oga,

I am having this problem: I know that Microsoft Access can prresent data in Forms and Reports [it makes it more graphical and beautiful].

I want to know if SQL can do that as well, because I have something to do with SQL and I have to display the data in forms.

Please answer as fast as you can!
proxies (m)
Re: Do You Have A Question On Sql?
« #15 on: January 06, 2008, 08:58 PM »

I have a web application.An E-cart to be specific. I'm using apache tomcat as my server but i don't know how to connect the application to MySql database, any help???
Bossman (m)
Re: Do You Have A Question On Sql?
« #16 on: January 07, 2008, 12:25 PM »

What have you done so far? Are you getting an error or so, if so what error?

Make sure the mySQL driver is in your applications classloader path. That is yourapp/WEB-INF/lib.

Also, make sure an instance of mySQL is running before accessing your web app. You can test that outside of your webapp with something like this method called "getConnection". If all is good, call this method from your servlet or whatever your webapp is.
---------------------------------------------------------------------------
Connection connection = null;
   try {
      Class.forName("org.gjt.mm.mysql.Driver").newInstance();
      connection = DriverManager.getConnection("jdbc:mysql://localhost/yourDatabasename");
   } catch(ClassNotFoundException cnfe) {
      throw new SQLException("Unable to load the driver: " + cnfe.getMessage());
   }
   return connection;
  }

  public static void main (String args[]) throws Exception{
     yourClass yc = new yourClass();
     System.out.println(yc.getConnection());
  }

Quote from: proxies on January 06, 2008, 08:58 PM
I have a web application.An E-cart to be specific. I'm using apache tomcat as my server but i don't know how to connect the application to MySql database, any help???
proxies (m)
Re: Do You Have A Question On Sql?
« #17 on: January 15, 2008, 10:28 PM »

Thanks, I don't really understand how to call the codes you gave me outside my application, so please could you put me through???
proxies (m)
Re: Do You Have A Question On Sql?
« #18 on: January 15, 2008, 11:06 PM »

Concernin what I have done so far, I have an E-Cart already all written in JAVA and Tomcat is my server, but what I want is:

1)To make a login/sign up page that takes into the mySql database each time a person signs up or login
2) then also keeps record of every item added by each user and to be stored in d database,
3) I want to be able to make d necessary sql options from the database like updte,insert,dellete,,
yaro248 (m)
Re: Do You Have A Question On Sql?
« #19 on: January 16, 2008, 01:42 PM »

@naijamark

you can delete any key associated with the softwrae from your registry, but you must be very careful not to delete some other keys that are not for the software you downloaded.
just use the name of the software as your search text in your registry.
Good luck.


As regards to char/varChar

I will suggest varchar for text because you may not have a specied length of the data you want to store.
I think it's also a good suggestion to use char(1) for gender.
 Open Source Banking Application?  Looking For Help With Actionscript In Flash  How can I Insert What I Desinged In Corel-draw Into Vb6.0 Through Image Control  Page 2
Pages: (1) Go Up Send Topic to Friend by E-mail Reply 
Google
 
Web www.nairaland.com
Sections: TV/Movies (2) Music/Radio (2) Celebrities Job Talk Jobs/Vacancies (2) Career Talk Romance Books Politics Sports Fashion Travel
Health Schooling Religion General(2) Business Webmaster Programming Computers Phones Cars & Trucks

Links: Page1 Page2 Page3 Page4 Page5 Page6 Page7 Page8 Page9 Page10

Nairaland is owned by Oluwaseun Osewa
Nairaland Forum | Powered by SMF 1.0.12.
© 2001-2005, Lewis Media. All Rights Reserved.