Stats: 3,190,152 members, 7,939,634 topics. Date: Wednesday, 04 September 2024 at 09:26 AM |
Nairaland Forum / Science/Technology / Programming / Do You Have A Question On Sql? (2260 Views)
Help Out! On SQL INJECTION / Video Tutorials On SQL, For Free / Help On SQL!!! (2) (3) (4)
Do You Have A Question On Sql? by mat6plus: 7:52pm On Dec 10, 2007 |
Do you have a question on SQL why don't you post them here and lets solve them together. |
Re: Do You Have A Question On Sql? by bobalalu(m): 10:47am On Dec 19, 2007 |
Hi, I dont 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 |
Re: Do You Have A Question On Sql? by my2cents(m): 3:30pm On Dec 19, 2007 |
mat6plus, should I store text data as char or varchar? Please provide reasons for whatever choice you suggest ![]() |
Re: Do You Have A Question On Sql? by Syma: 3:08pm On Dec 20, 2007 |
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. |
Re: Do You Have A Question On Sql? by Syma: 3:12pm On Dec 20, 2007 |
Obalalu Babatunde S. What programming language do u use? |
Re: Do You Have A Question On Sql? by Nobody: 3:38pm On Dec 20, 2007 |
@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 |
Re: Do You Have A Question On Sql? by Bossman(m): 10:25pm On Dec 20, 2007 |
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, Gridlock: |
Re: Do You Have A Question On Sql? by my2cents(m): 10:57pm On Dec 20, 2007 |
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. |
Re: Do You Have A Question On Sql? by Syma: 11:24am On Dec 27, 2007 |
inbox me and i will give you what u want. symccord@yahoo.com |
Re: Do You Have A Question On Sql? by Nobody: 3:50pm On Dec 27, 2007 |
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 |
Re: Do You Have A Question On Sql? by obotutuoko(m): 3:58pm On Dec 27, 2007 |
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 dont 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? |
Re: Do You Have A Question On Sql? by Bossman(m): 4:45pm On Dec 27, 2007 |
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. |
Re: Do You Have A Question On Sql? by samm(m): 6:47pm On Dec 27, 2007 |
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? |
Re: Do You Have A Question On Sql? by shinzoabe: 8:44pm On Jan 01, 2008 |
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! |
Re: Do You Have A Question On Sql? by Bossman(m): 11:33pm On Jan 01, 2008 |
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. shinzo abe: |
Re: Do You Have A Question On Sql? by proxies(m): 8:58pm On Jan 06, 2008 |
I have a web application.An E-cart to be specific. I'm using apache tomcat as my server but i dont know how to connect the application to MySql database, any help ![]() |
Re: Do You Have A Question On Sql? by Bossman(m): 12:25pm On Jan 07, 2008 |
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" ![]() 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()); } proxies: |
Re: Do You Have A Question On Sql? by proxies(m): 10:28pm On Jan 15, 2008 |
Thanks, I dont really understand how to call the codes you gave me outside my application, so please could you put me through ![]() |
Re: Do You Have A Question On Sql? by proxies(m): 11:06pm On Jan 15, 2008 |
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,, |
Re: Do You Have A Question On Sql? by yaro248(m): 1:42pm On Jan 16, 2008 |
@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. |
Re: Do You Have A Question On Sql? by adammessinger(m): 4:55pm On Aug 13, 2018 |
tuEagles Anti-Porn – The Internet is a dangerous place, not necessarily because of the high risk of contaminating your system with malicious software. Home computers in which youngsters are attracted by this viral phenomena called Internet are easily exposed to content that is not proper for their age. Luckily, applications such as Anti-Porn offer a helping hand in this regard. https://qopi.info/ff7c6a https://newfreesoftwares.com/tueagles-anti-porn-24-6-8-13-latest/ |
Re: Do You Have A Question On Sql? by Ayemileto(m): 8:29pm On Aug 14, 2018 |
@Syma I normally use ENUM for gender. Is Char better than this? Also, I don't know when to use a foreign key. The database seems quite OK by letting the tables work or get updated individually. Is this a bad practice? Also, I don't use "join" when fetching data from multiple tables. I use lots of "And" instead. Is this a bad practice? Bossman: |
Re: Do You Have A Question On Sql? by collins30: 3:26pm On Aug 16, 2018 |
If you are looking to start your training in Programming, then you need to be tutored by real web tutors who will guide you well. Enroll with Digital Dreams ICT Academy and get the best training. Want to know the better part, after training, you get to join our great community of students where you get solution, link up with tech guys and even get job offers. Visit http://digitaldreamsict.academy/index.php or call: 07064286765 today
|
(1) (Reply)
Official Thread For C# Experts And Beginners / So I Asked Avast To Restart My PC In The Next Century / How Can I Make A Website Interactive?
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 53 |