|
mat6plus
|
Do you have a question on SQL why don't you post them here and lets solve them together.
|
|
|
|
|
|
bobalalu (m)
|
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)
|
mat6plus, should I store text data as char or varchar? Please provide reasons for whatever choice you suggest 
|
|
|
|
|
|
Syma
|
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
|
Obalalu Babatunde S. What programming language do u use?
|
|
|
|
|
|
Gridlock (m)
|
@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)
|
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, @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)
|
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  In the end, it's all about space taken up on your server and efficiency.
|
|
|
|
|
|
|
|
naijamark (m)
|
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)
|
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)
|
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)
|
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
|
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)
|
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. 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)
|
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)
|
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()); } 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)
|
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)
|
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)
|
@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.
|
|
|
|
|
|