Hey there! Sign in to join this conversationNew here? Join for free
x Turn on thread page Beta

Self-teaching SQL and other programming languages watch

    • Thread Starter
    Offline

    3
    ReputationRep:
    Hello TSR

    I have no prior experience to programming with computer languages however I have found for several roles SQL is a skill in demand by employers. I would like to how difficult this would be to achieve and if there are alternative languages which are easier learn and to some degree less boring.

    Cheers


    Posted from TSR Mobile
    Offline

    15
    ReputationRep:
    (Original post by Singh89)
    Hello TSR

    I have no prior experience to programming with computer languages however I have found for several roles SQL is a skill in demand by employers. I would like to how difficult this would be to achieve and if there are alternative languages which are easier learn and to some degree less boring.

    Cheers


    Posted from TSR Mobile
    Hi mr Singh

    I've no programming experience at all.. But apparently sql is an easy language, however, you need to have a logical mind/approach to things.

    I found this site which may be helpful for a beginner:

    http://sqlzoo.net/wiki/Main_Page
    Offline

    17
    ReputationRep:
    (Original post by Singh89)
    Hello TSR

    I have no prior experience to programming with computer languages however I have found for several roles SQL is a skill in demand by employers. I would like to how difficult this would be to achieve and if there are alternative languages which are easier learn and to some degree less boring.

    Cheers


    Posted from TSR Mobile
    SQL is a piece of cake to start with and can get very complex once you master it. You can download a 180 day trial of SQL Server from MS at: https://technet.microsoft.com/en-gb/.../dn205290.aspx

    Give that an install and use their Adventure Works database to get yourself started.

    There are plenty of resources available on the net for learning SQL code. I'd recommend starting with some basic SELECT, DELETE, UPDATE and INSERT statements. :yep: This is your bread and butter SQL stuff.

    If you have any questions, feel free to PM me or quote me in here. I've been working with SQL server for a good number of years now, so I should be able to help you out, or at least point you in the right direction.

    Finally, if you want me to check any code, use the [code] and [/code] tags, to make your code look like this:

    Code:
    SELECT username, post_count
    FROM dbo.user_header
    WHERE user_name = 'Singh89'
    
    Returns:
    Singh89, 62
    Offline

    16
    ReputationRep:
    (Original post by mikeyd85)
    SQL is a piece of cake to start with and can get very complex once you master it. You can download a 180 day trial of SQL Server from MS at: https://technet.microsoft.com/en-gb/.../dn205290.aspx
    Or get the Express edition for free forever!
    Offline

    13
    ReputationRep:
    SQL is relatively simple language, one that's designed especially for data handling and databases. If you've got a computing job in data management, or are looking for one, it's going to be your bread and butter.

    If you're just looking at computing jobs in general, though, it's an unusual language to learn first because of its special, specific purpose. For general programming, it's best starting off on something fundamental like C++ and/or Java.
    Offline

    16
    ReputationRep:
    (Original post by Singh89)
    Hello TSR

    I have no prior experience to programming with computer languages however I have found for several roles SQL is a skill in demand by employers. I would like to how difficult this would be to achieve and if there are alternative languages which are easier learn and to some degree less boring.

    Cheers


    Posted from TSR Mobile
    Just remember the golden rule...
    DROP *
    FROM *
    Will troubleshoot any problem you have.
    Offline

    2
    ReputationRep:
    I wouldn't recommend SQL as a first language.

    It is relatively easy to use, and relatively useful. However, in terms of programming, you'd be better learning a third-gen language such as Python or PHP. SQL is meant to be used in conjunction with another language really. Alone, it's not really much use
    Offline

    3
    ReputationRep:
    If you have the inclination, go straight for the jugular and learn Java.
    Offline

    16
    ReputationRep:
    (Original post by A5ko)
    If you have the inclination, go straight for the jugular and learn Java.
    :no:
    Offline

    19
    ReputationRep:
    (Original post by mikeyd85)
    Code:
    SELECT username, post_count
    FROM dbo.user_header
    WHERE user_name = 'Singh89'
    
    Returns:
    Singh89, 62
    Express edition is free for life.

    Also, your SQL statement is not representative of what is actually used. You don't store the post count on the user table. You find the post count by selecting the total number of posts a user has made. If you were to store post count on the same table as the user table then you'd have to update the user table each time a user makes a new post. That's like storing somebodys age. You don't store somebody age because your age changes very frequently. You just store their date of birth, and upon request you can easily calculate their age. Same logic.

    Also, selecting where user_name = 'Singh89' might be a bit ambigious if there's multiple users with the same name, unless user_name is a primary key. Typically, a UserID is used to search for a users data since that's always the Unique Primary key.

    Also, you have two fields to store the same thing?
    [SELECT username]
    [WHERE user_name]

    you have username and user_name. Unless that was a typo.
    Offline

    18
    ReputationRep:
    I wouldn't start with a query language, I would start with something like VB.NET/Java/Python.
    Offline

    16
    ReputationRep:
    (Original post by Async)
    You don't store the post count on the user table. You find the post count by selecting the total number of posts a user has made.
    Could be a view
    Offline

    17
    ReputationRep:
    (Original post by Async)
    Express edition is free for life.

    Also, your SQL statement is not representative of what is actually used. You don't store the post count on the user table. You find the post count by selecting the total number of posts a user has made. If you were to store post count on the same table as the user table then you'd have to update the user table each time a user makes a new post. That's like storing somebodys age. You don't store somebody age because your age changes very frequently. You just store their date of birth, and upon request you can easily calculate their age. Same logic.

    Also, selecting where user_name = 'Singh89' might be a bit ambigious if there's multiple users with the same name, unless user_name is a primary key. Typically, a UserID is used to search for a users data since that's always the Unique Primary key.

    Also, you have two fields to store the same thing?
    [SELECT username]
    [WHERE user_name]

    you have username and user_name. Unless that was a typo.
    Really, it was just an example of what the [code][/code] tags would do with information that could be easily related to on the screen at the time.

    I do think post count would be store though. If each time a person loads a webpage, a COUNT statement is run to work out each user's post count, then TSR has much, much more server power than I thought.

    Edit: I'd love to see the schema for TSR. :yep:
    Offline

    19
    ReputationRep:
    (Original post by mikeyd85)
    Really, it was just an example of what the [code][/code] tags would do with information that could be easily related to on the screen at the time.

    I do think post count would be store though. If each time a person loads a webpage, a COUNT statement is run to work out each user's post count, then TSR has much, much more server power than I thought.

    Edit: I'd love to see the schema for TSR. :yep:
    Every time you re-load your browser you fire an SQL command. Modern SQL servers were designed to execute queries fast so I don't think that would be much of a problem, as long as you have good enough servers.

    But I do see your point though, if a user has made so many posts surely that would take a lot of server power to process.

    But then again, I remember selecting the count of data which returned 8K. And it returned the data instantly. Select the count of something is different than to displaying the table data.

    Code:
    Select Count(*) From tblPost
    is wayyy different from

    Code:
    Select * From tblPost
    Count is quicker, I'm sure there is a way they do it in order for it to be fast. I think it's because they don't have to render any data to display.. All they show is an Integer.... Soo yeah.. Maybe we can get a database expert to shed some light on this.
    Offline

    17
    ReputationRep:
    (Original post by Async)
    Every time you re-load your browser you fire an SQL command. Modern SQL servers were designed to execute queries fast so I don't think that would be much of a problem, as long as you have good enough servers.

    But I do see your point though, if a user has made so many posts surely that would take a lot of server power to process.

    But then again, I remember selecting the count of data which returned 8K. And it returned the data instantly. Select the count of something is different than to displaying the table data.

    Code:
    Select Count(*) From tblPost
    is wayyy different from

    Code:
    Select * From tblPost
    Count is quicker, I'm sure there is a way they do it in order for it to be fast. I think it's because they don't have to render any data to display.. All they show is an Integer.... Soo yeah.. Maybe we can get a database expert to shed some light on this.
    I reckon asking in this thread would probably get the answer! :lol:

    Much of this will be down to the schema of the db.
    Offline

    19
    ReputationRep:
    (Original post by mikeyd85)
    I reckon asking in this thread would probably get the answer! :lol:

    Much of this will be down to the schema of the db.

    Done. Now let's wait for his reply
    Offline

    16
    ReputationRep:
    In SQL Server, COUNT is an O(n) operation in terms of the counted items. So it is more expensive to count on the fly than to store a count and this will scale linearly with the number of posts that have to be counted.

    Not only that, but every row has to be loaded in full in order to count it (unless you have a non-clustered index against the table, in which case only the index keys have to be loaded, which will dramatically reduce I/O time).

    When there are large numbers of rows to count, there is a case for storing a count separately. Or, better still, use a more appropriate storage mechanism for your posts (such as a document database) and count them in O(1) time by simply indexing the post count against each user.

    I presume other SQL platforms are similar.
    Offline

    19
    ReputationRep:
    (Original post by Planto)
    In SQL Server, COUNT is an O(n) operation in terms of the counted items. So it is more expensive to count on the fly than to store a count and this will scale linearly with the number of posts that have to be counted.

    Not only that, but every row has to be loaded in full in order to count it (unless you have a clustered index against the table, in which case only the index keys have to be loaded, which will dramatically reduce I/O time).

    When there are large numbers of rows to count, there is a case for storing a count separately. Or, better still, use a more appropriate storage mechanism for your posts (such as a document database) and count them in O(1) time by simply indexing the post count against each user.

    I presume other SQL platforms are similar.
    Makes sense, I was thinking something similar to something being Indexed but I couldn't put my finger on it.
    Offline

    16
    ReputationRep:
    (Original post by Async)
    Makes sense, I was thinking something similar to something being Indexed but I couldn't put my finger on it.
    I think there are tricks you can use involving scanning system tables and so forth to retrieve quicker (but potentially less accurate) counts but if you're gonna go down that route you have to start wondering if it isn't worth just storing a count separately.
    • TSR Group Staff
    Offline

    19
    ReputationRep:
    TSR Group Staff
    (Original post by Async)
    Done. Now let's wait for his reply
    Her reply

    Yes we store the number of posts against each user in the user table, which is updated whenever a post is made. It would be very slow to calculate the number of posts for a member every time that member profiles is loaded, as there are over 5 million posts.
 
 
 
Reply
Submit reply
Turn on thread page Beta
TSR Support Team

We have a brilliant team of more than 60 Support Team members looking after discussions on The Student Room, helping to make it a fun, safe and useful place to hang out.

This forum is supported by:
Updated: February 16, 2015
Poll
Do you agree with the proposed ban on plastic straws and cotton buds?

The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE

Write a reply...
Reply
Hide
Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.