3 ms·
SQL is a declarative language, not imperative. IE you describe what you want, rather than a set of instructions for extracting it. Database engines have "quer
by joeclark77 11y ago
SQL is a declarative language, not imperative. IE you describe what you want, rather than a set of instructions for extracting it. Database engines have "query optimizers" that use relational algebra to find the most efficient ways to process a SQL query, and they make a huge difference when your databases get big.
What R brings to the table are numerous statistical methods packages and some good data visualization packages. With just a few lines you can apply some sophisticated techniques and produce beautiful visualizations.
SQL can indeed do some complex analytics, but they're very difficult, so R is the easier platform for statistics and machine learning. I did a Coursera class recently in which we had to do matrix multiplication with SQL and even that was a brain teaser of a puzzle. The advantages of doing analytics within a database are (a) leveraging the query optimizer to speed up your analysis and (b) you can make the analysis available to other users of the same system via a view or stored procedure, so they don't have to do the same work twice.