3 ms·
All of those can be done in the CLI and quickly. CLI has a learning curve but what many will say is that we are SO GLAD we learned to not use our mouse to work
by baldfat 11y ago
All of those can be done in the CLI and quickly.
CLI has a learning curve but what many will say is that we are SO GLAD we learned to not use our mouse to work with our data base and especially our SQL code.
The reason why I like using CLI is I can use GIT or any version control and make sure I have a clear history of my SQL commands and everything I did.
TL:DR Database Vendor with a Windows Server product screw with the logs and put the blame on me. I had a version control of all our history of CLI commands. Vendor employee or manager changed our log files externally. We won big court case (Before trial of course). Wouldn't have happened if I used the GUI tools.
Long story short. The vendor at the library I want was 100% evil. I asked by phone about two things. I emailed the engineer after the phone call for the two questions. BOOM I lost one month of work unless my backups work. Boom I lost half a day of work for 2 librarians. Vendor tells my boss and my school it will cost us $5,000 due to my mistake for them to fix something (Took them 15 minutes work on the phone due to their error).
My boss and college have a good relationship with me and we go on a conference call. Vendor tells a very convincing story and logs how I screwed up. They don't have records of my phone call and have 100% confidence that their employee would never okay both those things. I call them on the table. I have the email with the answers that the engineer gave me. BOOM their Engineer VP jumps in and says see if you did what he told you nothing bad would have happened and our logs show ... I than email my version controlled CLI commands for the past 6 months and show my commands that I did that day and that if the logs on their end our different they have a serious problem internally.
Long story short we won the court case and we got over hundreds of thousands of dollars back from that vendor.
- philh 11y ago> All of those can be done in the CLI and quickly. I'd love to know how.
- pjungwir 11y agoI use psql exclusively but I think those are good questions and I'd love to see someone give you an answer. Personally I don't feel much friction using psql even for "exploration", but I can see how a GUI would let you more easily follow data from one table to another. EDIT: I've just barely tried it, but it looks like you could say `\g |vim -` (with a csv plugin) or `\g |csvlook` (not great) and then browse/sort/aggregate the data from there. You probably need to change the output formatting though, because it looks like \g doesn't automatically give you something easy to parse. I have a feeling an interactive command-line CSV reader (less(1) for csv files) would be really useful to a lot of people, but I don't know of anything like that. csvkit isn't interactive as far as I know. csvtool dies on big files. Any alternatives? It would be the perfect thing to combine with \g. EDIT EDIT: Or just \pset pager and you don't need \g at all. . . .
- baldfat 11y agoI would try: First One Hour: https://www.khanacademy.org/computing/hour-of-code/hour-of-sql/v/welcome-to-sql https://www.khanacademy.org/computing/hour-of-code/hour-of-s... Also these two seem decent: http://sol.gfxile.net/galaxql.html http://sol.gfxile.net/galaxql.html http://sql.learncodethehardway.org/ http://sql.learncodethehardway.org/ The Hard Way has semi-decient issues. I would say SQL is easy to learn and would take only a few days to get the basics and than just learn as you come to stuff your missing. SQL is a very tiny language.
- philh 11y agoSo, when you read these parts of my post: > Edit your query to add an ORDER BY clause? > Check the primary key and write an UPDATE query? Hope not to make a typo when writing the key. > write a SELECT query? did you think that I was saying: "I think this is how I would do it in SQL, if only I knew SQL. Won't you please point me to somewhere I can learn SQL so that all my problems will be solved"? Because what I was going for was: "here is how I would do it in the CLI, but I much prefer how I would do it in PMA. Please tell me if there's a better way to do it in the CLI". I know SQL, I thought it was obvious that I knew SQL, and pointing me towards SQL tutorials is super unhelpful.
- baldfat 11y agoGo to Stack Overflow. Yes the reason why no one gave you your SQL code is we know that the GUI is just making SQL code for you. Sorry we probably have the mindset of we pointed you to the answer and we are not going to give you specific answer to your questions. I googled searched by copy and paste your question for 5 seconds for each question: > Edit your query to add an ORDER BY clause? http://www.techonthenet.com/sql/order_by.php http://www.techonthenet.com/sql/order_by.php > Check the primary key and write an UPDATE query? http://stackoverflow.com/questions/3930338/sql-server-get-table-primary-key-using-sql-query http://stackoverflow.com/questions/3930338/sql-server-get-ta... > write a SELECT query http://www.w3schools.com/sql/sql_select.asp http://www.w3schools.com/sql/sql_select.asp I think your issue is you are biased against CLI and think you get more benefit from a GUI. We can convince you what is best for you. We are just saying everything you pointed out is easily done in CLI with SQL commands. We believe everyone who works with databases should use CLI for a number of benefits because of our own experience.
- danso 11y agoNice example of how learning the language has some intrinsic advantages that quickly outweigh the inconvenience of having to learn the language. It took me awhile to learn SQL myself and so I dread a bit having to teach it...but while I love spreadsheets...it is incredibly tiring having to create tutorials in which you explain which button to click and where and in what specific sequence and to make sure you've dragged the mouse so far and held Ctrl (or Cmd depending on what OS you are)...nevermind the problem of troubleshooting (what did you click before you clicked that button and did you left-click or right-click it and, btw, what version of Windows are you on?). SQL is difficult to learn for new programmers...but I find that that hurdle quickly pays off...no one ever keeps track of how much time they lose to struggling with the GUI because, well, doing things with the GUI are generally very hard to track. And it's a useful revelation, that being explicit, that having the ability to express exactly what you want, has a certain power to it. It's like teaching how to read and write to people who've so far learned only how to communicate in emoji