redarrow Posted April 12, 2006 Share Posted April 12, 2006 Hope you can help i am trying to learn all the most used querys are these query below right if not can you tell me how to do them properly thank you.These mysl database querys has to be learnt before i can proceed on my course thank you.// Insert database[code]$query="insert into a (name,age)('$name','$age')";[/code]//Query database[code]$query="select * form a";[/code]// Update database[code]$query="update a set name='$name' where name='$name'";[/code]//Delete database[code]$query="delete from a where name='$name'";[/code]// Drop a table[code]$query="drop table a";[/code]//Drop database[code]$query="drop database a";[/code]//Drop database[code]$query="alter table a drop'";[/code] Quote Link to comment Share on other sites More sharing options...
obsidian Posted April 12, 2006 Share Posted April 12, 2006 i think you've got them for the most part, but you've got a couple misspellings and missing words ;-)INSERT:[!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']INSERT[/span] [color=green]INTO[/color] [color=orange]a[/color] (name,age) VALUES ([color=red]'$name'[/color],[color=red]'$age'[/color]);[!--sql2--][/div][!--sql3--]SELECT:[!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']SELECT[/span] * [color=green]FROM[/color] [color=orange]a;[/color] [!--sql2--][/div][!--sql3--]also, your alter table is right syntax, but it does not allow you to drop the table:[!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']ALTER TABLE[/span] a [span style=\'color:blue;font-weight:bold\']DROP[/span] COLUMN col_1;[!--sql2--][/div][!--sql3--]hope this helps Quote Link to comment Share on other sites More sharing options...
redarrow Posted April 12, 2006 Author Share Posted April 12, 2006 Thank you for your support obsidian.Can you kindly exsplain what the * does in a select query cheers other wise solved. Quote Link to comment Share on other sites More sharing options...
obsidian Posted April 12, 2006 Share Posted April 12, 2006 [!--quoteo(post=364042:date=Apr 12 2006, 10:32 AM:name=redarrow)--][div class=\'quotetop\']QUOTE(redarrow @ Apr 12 2006, 10:32 AM) [snapback]364042[/snapback][/div][div class=\'quotemain\'][!--quotec--]Thank you for your support obsidian.Can you kindly exsplain what the * does in a select query cheers other wise solved.[/quote]sure. the "*" simply says to select ALL COLUMN from the rows that match the query. the alternative would be to define which columns you want to pull only:[!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']SELECT[/span] col_1, col_2, col_3 [color=green]FROM[/color] [color=orange]a;[/color] [!--sql2--][/div][!--sql3--] Quote Link to comment Share on other sites More sharing options...
redarrow Posted April 12, 2006 Author Share Posted April 12, 2006 [!--quoteo(post=364045:date=Apr 12 2006, 02:35 PM:name=obsidian)--][div class=\'quotetop\']QUOTE(obsidian @ Apr 12 2006, 02:35 PM) [snapback]364045[/snapback][/div][div class=\'quotemain\'][!--quotec--]sure. the "*" simply says to select ALL COLUMN from the rows that match the query. the alternative would be to define which columns you want to pull only:[!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']SELECT[/span] col_1, col_2, col_3 [color=green]FROM[/color] [color=orange]a;[/color] [!--sql2--][/div][!--sql3--][/quote]Thank you agin.[!--sizeo:4--][span style=\"font-size:14pt;line-height:100%\"][!--/sizeo--]solved[!--sizec--][/span][!--/sizec--] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.