[R] SQL and R
akshay kulkarni
@k@h@y_e4 @end|ng |rom hotm@||@com
Thu Dec 12 10:24:17 CET 2024
Dear Calum,
THanks for the simple and practical answer.
Thanking you,
Yours sincerely
AKSHAY M KULKARNI
________________________________
From: CALUM POLWART <polc1410 using gmail.com>
Sent: Thursday, December 12, 2024 4:22 AM
To: Sorkin, John <jsorkin using som.umaryland.edu>
Cc: akshay kulkarni <akshay_e4 using hotmail.com>; R help Mailing list <r-help using r-project.org>; avi.e.gross using gmail.com <avi.e.gross using gmail.com>; Ben Bolker <bbolker using gmail.com>
Subject: Re: [R] SQL and R
And to answer the dependency question.
Neither is dependent on the other. But both can be complimentary.
If you consider that SQL*may* be a route to accessing your data (if it's in a database).
And R *may* be a route to analysis of the data.
If the data is in a CSV file, Excel file, API etc. you don't need SQL. IF it is in a database, you might extract it to CSV etc. or you might directly access it from R
If ALL you want is some simple number counts you can do that in SQL. NO NEED FOR R. So for instance you could have a database for a warehouse. There could be three tables in that database (you'll have far more).
Orders
Customers
Products
Products lists all your products - with a product code.
Customers lists all the customers with a customer code
And orders lists the customer code, date and product ordered.
SQL will let you create a "view" of that data that shows the customer address, and product name.
SQL can also tell you how many of a product were ordered by postal area in a month even though the data is not organised like that.
R can do that analysis too. But it could do far more statistical analysis and say run a stats test to see if male customers are more likely to buy beer than female. I don't think that's possible in SQL.
Sometimes you could just pull the whole database into R and analyse it. But if you imagine that database was actually every sale made in Walmart in the last 10 years, the database is huge. It would be better to extract the beer sales and males and females only which is hopefully smaller to analyse...
On Wed, 11 Dec 2024, 21:39 Sorkin, John, <jsorkin using som.umaryland.edu<mailto:jsorkin using som.umaryland.edu>> wrote:
Dear Askay,
I believe my grey hair allows me to help answer your question. SQL, and its progenitor SEQUEL, were developed specifically to manipulate relational databases. It was developed in the early 1970s (equivalent to the historical bronze age) when the concept of a relational database (see https://en.wikipedia.org/wiki/Relational_database) and Codd's 12-rules were being developed (see https://en.wikipedia.org/wiki/Codd%27s_12_rules)
At the time, the concept of a relation database and a programming language dedicated to manipulating them was revolutionary. The concept was clearly needed, important, and well used; a commercial version of SQL, Oracle, made Larry Ellison more than a quarter billionaire.
S, one of the progenitors of R, was developed later. In 1975 by John Chambers, Rick Becker, Trevor Hastie, and William Cleveland (all of whom, I believe worked at Bell Labs) developed S as a general programming language. It was NOT developed specifically for the manipulation of relational databases. S had modest success in academia. S-Plus, a commercial version of R was developed fairly recently in 1988 by a company Statistical Sciences. The founder of Statistical Sciences was R. Douglas Marin who was a professor of statistics at the University of Washington, Seattle.
S was also the progenitor of R. R was developed by Ross Ihaka and Robert Gentlemen in 1993, faculty members of the University of Auckland. Given the ubiquity of R in academia, it is clear that S, much like SQL has been extraordinarily successful.
John
John David Sorkin M.D., Ph.D.
Professor of Medicine, University of Maryland School of Medicine;
Associate Director for Biostatistics and Informatics, Baltimore VA Medical Center Geriatrics Research, Education, and Clinical Center;
PI Biostatistics and Informatics Core, University of Maryland School of Medicine Claude D. Pepper Older Americans Independence Center;
Senior Statistician University of Maryland Center for Vascular Research;
Division of Gerontology and Paliative Care,
10 North Greene Street<https://www.google.com/maps/search/10+North+Greene+Street?entry=gmail&source=g>
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
Cell phone 443-418-5382
________________________________________
From: R-help <r-help-bounces using r-project.org<mailto:r-help-bounces using r-project.org>> on behalf of akshay kulkarni <akshay_e4 using hotmail.com<mailto:akshay_e4 using hotmail.com>>
Sent: Wednesday, December 11, 2024 8:16 AM
To: R help Mailing list
Subject: [R] SQL and R
dear Members,
I have recently started studying SQL and MySQL. My question is, what exactly is SQL used for? That is, whatever can be done by SQL, like subsetting and filtering of data sets, can also be done by R. What's, then, the advantage of SQL? It is OK if you tag this question as offtopic, but I could'nt find any info on the web. Can you please refer me
QL complement R? Are both dependent?
THanking you,
Yours sincerely,
AKSHAY M KULKARNI
[https://s-install.avcdn.net/ipm/preview/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif]<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> Virus-free.http://www.avast.com/<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
[[alternative HTML version deleted]]
______________________________________________
R-help using r-project.org<mailto:R-help using r-project.org> mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide https://www.r-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
______________________________________________
R-help using r-project.org<mailto:R-help using r-project.org> mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide https://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
[[alternative HTML version deleted]]
More information about the R-help
mailing list