Learning resource question

Started by Mötley, Dec 06, 2016, 01:26 PM

Previous topic - Next topic

Mötley

Hi, I would like to see if one of the developers and or someone like Thijn etc, If they could do a quickie view of

http://www.tizag.com/sqlTutorial/index.php

Of how they are teaching SQL, If from there glance threw etc appears to be trustworthy, Compared to "I'm learning it the wrong way". That's all. I really like this site so far and I would really hate to study a lot wrongly.

Please no Spam, This is a honest question as I have learned a lot from this site. I would also recommend this site,

KAKAN

That seems pretty outdated. And I really hate that color combination, with something white, it would be better to read( just my opinion ).
Or, if you just want a basic, quick tutorial, proceed here:- http://tutorialzine.com/2016/01/learn-sql-in-20-minutes/
oh no

Thijn

I don't think there's a wrong way to learn SQL.
It's not a programming language, it's more like XML. If you're doing it wrong it wont work.
The only thing you can do wrong with SQL is making a lot of expensive sub-queries and thus making your overall query slow. But I doubt that's going to happen with a VC:MP server...

Mötley

#3
After studying into SQL decently fair time to time it's honestly really easy.

It can be complicating at small time moments when something fu4* up but easy to fix once you realize what you have done,

"Like if nothing gets added to the SQL Query,"

I have read script releases on this site and LU and I really do not understand why people are giving stuff to the player like cash and level.
MAKES NO SENSE

But I must say.. What's even the point to a constructor? I do not think it's needed what so ever, Only makes it look fancy... I honestly discourage it, Mainly because there is not one release that is proper between both multi-players...

KAKAN

class constructor, you mean? They're there for you so you won't need to make unnecessary calls to functions after initializing the class. They're also useful for passing values at the initializing time of a class( or object ) and doing....
oh no

Mötley

#5
I will keep that in mind. It seems faster on practice and testing a new query when your just running it within a function a basic function.

I will also keep in mind to terminate that class definition with a semicolon. I will just make it really fancy I suppose ;)..
[mergedate]1481115501[/mergedate]
Just a question, I might have a few more,

In SQL you have Select All (*)

I do not know yet if the module can handle it "Untested", But is this also thought against by others? The thought sounds really nice

For those that do not Know

"SELECT (*)" is a shortcut that can be used to select all table columns rather than listing each of them by name. Unfortunately, going this route doesn't allow for you to alter the presentation of the results.

But

The (*) query statement should be used with caution. Using this against a little database will surely do no harm, but using this query against an extremely large database may not be the best practice.



I will get around to testing S.L.C Module and Storms Module to see if they can both handle it, "Coded in".

And I will assume that the output is

local query = ::QuerySQL( g_database, "SELECT * FROM Accounts WHERE Name='" + daplayer + "'" );This only has the Players name, Password, IP, UID. Nothing else in that query, Might add a autologin to it, Not sure..

Thijn

The problem with SELECT * is you don't know for certain what index is what column.

What if you have your kills on index 10, but decide to change your table structure and add a column before the kills. You'd have to change your script in order to treat index 11 as kills. Specifying what columns you want to return makes you know for certain on what index what column is, no matter if that changes over time.

(SELECT * is standard SQL, and thus supported by both plugins)

vito

mysql_fetch_assoc should work with column's names (but I am not sure how it works in vc-mp plugin)

KAKAN

Quote from: vito on Dec 09, 2016, 10:19 AMmysql_fetch_assoc should work with column's names (but I am not sure how it works in vc-mp plugin)
Same like in other shits. It will return a table.
oh no

Mötley

What about this,

After some study and thought as to how I should go about implementing what I studied so far with SQL into squirrel.



What If I created a way to load only the registration query into a index array/Class/Constructor, And once a simple Timer is added to the server I update The Query if any new accounts were added etc? I thought about doing this with the Stat query, But the accounts made a little more sense, Maybe this is a stupid Idea, My thoughts tell me that It would be good,

class AcQueryClass
{
Name = null;
Password = "";
IP = "";
Updated = false;
}

If that query received an update, update that account according to the class, And always retrieve data from the class only. Never the Query. And With doing so I would Update the query Hourly.

Please do not give it a bad thought If it's because of a timer. I'm only curious and getting close to scripting this in.