Computer Webmaster Gaming Console Graphics Forum

Welcome to the Computer Webmaster Gaming Console Graphics Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

MK PitStop Main Earn $25 Earn Money Posting Extras Members Blogs Image Hosting User Pages
Go Back   Computer Webmaster Gaming Console Graphics Forum > Webmaster Forum > Website Coding > Database
Register FAQ/Rules Become A V.I.P. Member Search Today's Posts Mark Forums Read

Database Database problems or need to ask a question? maybe something to do with sql injections or a database software question. Database topics cover MySQL, PostgreSQL, Oracle, SQL Server or anything else related to databases.

Google
Reply
 
LinkBack Thread Tools Display Modes
Old 03-30-2006, 8:52 PM   #1
Whatcha
Back Office Guy-
 
Whatcha's Avatar
 
Join Date: Mar 2006
Location: At my pc
Posts: 533
My Photos: (6)
iTrader: (0)

Banked:
MK Cash: $0.00

I am Worth:
MK Cash: $0.36
Donate

Recent Blog: None

Whatcha is just really niceWhatcha is just really niceWhatcha is just really niceWhatcha is just really niceWhatcha is just really nice
Default Looking for any handy SQL queries

Laggin behind in my sql knowledge at present any one know any good hints & tips sites. Or very good in depth tutorials
Whatcha is offline  
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Reply With Quote
Advertisements
Old 03-31-2006, 8:59 PM   #2
weirfire
MK PitStop Member
 
weirfire's Avatar
 
Join Date: Mar 2006
Posts: 66
My Photos: (0)
iTrader: (0)

Banked:
MK Cash: $0.00

I am Worth:
MK Cash: $0.00
Donate

Recent Blog: None

weirfire will become famous soon enoughweirfire will become famous soon enough
Default

Try www.php.net , http://www.w3schools.com/sql/default.asp , http://www.mysql.com/

Thats all my favourites for sql help.
__________________
web development Free diggs for your stories
bags of fashion - the latest in fashionable handbags
weirfire is offline  
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Reply With Quote
Old 03-31-2006, 9:15 PM   #3
Whatcha
Back Office Guy-
 
Whatcha's Avatar
 
Join Date: Mar 2006
Location: At my pc
Posts: 533
My Photos: (6)
iTrader: (0)

Banked:
MK Cash: $0.00

I am Worth:
MK Cash: $0.36
Donate

Recent Blog: None

Whatcha is just really niceWhatcha is just really niceWhatcha is just really niceWhatcha is just really niceWhatcha is just really nice
Default

Yer got the links, good for the basic stuff but sorry to say find mysql.com manual one of the most mind boggling manuals ever.

would like to try and find some with examples to semi complex queries i.e. insert into mailing list * from (select unique email from users) etc

reading examples gives me ideas on streamling and automation
Whatcha is offline  
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Reply With Quote
Old 05-16-2006, 12:09 AM   #4
weirfire
MK PitStop Member
 
weirfire's Avatar
 
Join Date: Mar 2006
Posts: 66
My Photos: (0)
iTrader: (0)

Banked:
MK Cash: $0.00

I am Worth:
MK Cash: $0.00
Donate

Recent Blog: None

weirfire will become famous soon enoughweirfire will become famous soon enough
Default

Well I personally built my own database connection functions which I use all the time.

They go like this;

// Function to open a database connection
function OpenDB(){
$dbh=mysql_connect ("localhost", "$username", "$password")
or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("$db");

return $dbh;
}

// Function to close a database connection
function CloseDB($dbh){
mysql_close($dbh);
}

// Then I set an includes to the file with the function list as follows;
include 'includes/functions.php';

// Then I call my OpenDB function
$dbh = OpenDB();

// Then I run my mysql query and extract the data
$query = "SELECT * FROM table WHERE id >5";
$result = mysql_query($query);
while($row = mysql_fetch_array($result)){

$fieldname = $row['fieldname'];
$fieldname2 = $row['fieldname2'];

echo $fieldname . ' - ' . $fieldname2 . ' <br> ';

}

// Then I close the database
CloseDB($dbh);
__________________
web development Free diggs for your stories
bags of fashion - the latest in fashionable handbags
weirfire is offline  
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Reply With Quote
Old 05-16-2006, 12:11 AM   #5
weirfire
MK PitStop Member
 
weirfire's Avatar
 
Join Date: Mar 2006
Posts: 66
My Photos: (0)
iTrader: (0)

Banked:
MK Cash: $0.00

I am Worth:
MK Cash: $0.00
Donate

Recent Blog: None

weirfire will become famous soon enoughweirfire will become famous soon enough
Default

One fantastic method for searching for keyterms I've found is

SELECT * FROM table WHERE fieldname LIKE '%keyword%'

This returns all the results from the table where the value in the field has the keyword somewhere in the text.
__________________
web development Free diggs for your stories
bags of fashion - the latest in fashionable handbags
weirfire is offline  
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Reply With Quote
Old 05-16-2006, 9:55 AM   #6
MadKad
Website Owner
 
MadKad's Avatar
 
Join Date: Mar 2006
Location: UK
Posts: 3,888
My Photos: (46)
iTrader: (3)

Banked:
MK Cash: $3.06

I am Worth:
MK Cash: $1.92
Donate


MadKad is a jewel in the roughMadKad is a jewel in the roughMadKad is a jewel in the rough
Default

I am not that great on sql my self but that tip is a good tip I would probably give it a go if I ever need to, thank you
MadKad is online now  
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Reply With Quote
Old 05-16-2006, 12:04 PM   #7
weirfire
MK PitStop Member
 
weirfire's Avatar
 
Join Date: Mar 2006
Posts: 66
My Photos: (0)
iTrader: (0)

Banked:
MK Cash: $0.00

I am Worth:
MK Cash: $0.00
Donate

Recent Blog: None

weirfire will become famous soon enoughweirfire will become famous soon enough
Default

SQL isn't that difficult to learn. Once you get the whole idea of sets and the correct terminology its fairly straight forward.

I did advanced databases at university using Oracle. Now that was tough!! I think I had 1 query which recurred from about 8 seperate queries and was about 250 lines long lol.
__________________
web development Free diggs for your stories
bags of fashion - the latest in fashionable handbags
weirfire is offline  
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Reply With Quote
Old 05-16-2006, 6:52 PM   #8
MadKad
Website Owner
 
MadKad's Avatar
 
Join Date: Mar 2006
Location: UK
Posts: 3,888
My Photos: (46)
iTrader: (3)

Banked:
MK Cash: $3.06

I am Worth:
MK Cash: $1.92
Donate


MadKad is a jewel in the roughMadKad is a jewel in the roughMadKad is a jewel in the rough
Default

LOL weirfire, I hate database's I am getting there I think but Whatcha will have to say if I am or not here does all the db and php stuff and is really fast and good
MadKad is online now  
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Reply With Quote
Old 05-16-2006, 9:57 PM   #9
weirfire
MK PitStop Member
 
weirfire's Avatar
 
Join Date: Mar 2006
Posts: 66
My Photos: (0)
iTrader: (0)

Banked:
MK Cash: $0.00

I am Worth:
MK Cash: $0.00
Donate

Recent Blog: None

weirfire will become famous soon enoughweirfire will become famous soon enough
Default

Yeah, I might have a few jobs for him soon. I reckon there's about 6 big jobs starting shortly which is a bit too much to take on at one time. My main helper is exam (David) though as he's a great reliable PHP programmer.
__________________
web development Free diggs for your stories
bags of fashion - the latest in fashionable handbags
weirfire is offline  
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Reply With Quote
Old 06-07-2006, 5:46 AM   #10
Poster
Member Level 1
 
Poster's Avatar
 
Join Date: Jun 2006
Posts: 5
My Photos: (0)
iTrader: (0)

Banked:
MK Cash: $0.00

I am Worth:
MK Cash: $0.50
Donate

Recent Blog: None

Poster is on a distinguished road
Default

One commonly used sql query is finding the nth largest record from a table. For example, you may require 5th largest number from an id column.

In that case, in Oracle you would have to solve it by using a subquery. In SQL Server, the following query would work.

select top 1 empno from employee where empno not in (select top 4 empno from employee order by empno) order by empno

I think the query is the same in My SQL also. Please let me know.
Poster is offline  
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Reply With Quote
Featured Websites
Free Space
Free Space
Free Space Free Space
Reply
Tags: , ,




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Featured Websites




All times are GMT +1. The time now is 2:27 AM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.0.0
Cheap Computers
MK PitStop Copyright 2005 - 2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98