- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Yash Sanghvi has Published 220 Articles
Yash Sanghvi
3K+ Views
Formatting the code is quite important to make it readable. It is recommended that you properly format the code regularly, and especially before sharing it with someone else.Follow these steps to auto-format code in Arduino IDE −Go to ToolsClick on Auto FormatAlternatively, you can press Ctrl+T on your keyboard. This ... Read More
Yash Sanghvi
6K+ Views
In order to change the baud rate of the Serial Monitor, go to Tools -> Serial Monitor (or press Ctrl+Shift+M alternatively).Make sure you have a board connected to your PC/Laptop, or the Serial Monitor won't open. Also, make sure that the Port corresponds to the connected board.Once the Serial Monitor ... Read More
Yash Sanghvi
160 Views
There are 6 types of constraints that can be generally used with a PostgreSQL table. They are listed and explained below −NOT NULL CONSTRAINTThis is a very common constraint. If there is a particular column that cannot have null values, you add this constraint at the time of table creation. ... Read More
Yash Sanghvi
2K+ Views
Although quite infrequent, you may come across situations wherein you need to define the primary key on an existing table. This can be achieved using the ALTER TABLE statement.The syntax is −ALTER TABLE table_name ADD PRIMARY KEY (column_name1, column_name2, …., columns_nameN)As can be seen from the above syntax, you can ... Read More
Yash Sanghvi
945 Views
Let us create a new table containing a single timestamp column −CREATE TABLE timestamp_test( ts timestamp );Now let us populate it with some data −INSERT INTO timestamp_test(ts) VALUES(current_timestamp), (current_timestamp+interval '5 days'), (current_timestamp-interval '18 hours'), (current_timestamp+interval '1 year'), (current_timestamp+interval '3 minutes'), (current_timestamp-interval '6 years');If you query the table (SELECT * ... Read More
Yash Sanghvi
157 Views
Often, we have some very long table names, and writing the table name every time is troublesome. We can use aliasing to help us there, thanks to which, we will need to write the long table name only once.The table aliases are generally written in the FROM part of the ... Read More
Yash Sanghvi
1K+ Views
Suppose you have a table user_info that contains the state and district of different users. An example is given below −namedistrictstateAnilMumbaiMaharashtraJoyJhalawarRajasthanRonPuneMaharashtraReenaMeerutUttar PradeshNow, if you want to combine the state and district in a single field called location, this is how you should be able to do it −SELECT name, district ... Read More
Yash Sanghvi
4K+ Views
Suppose you have a table user_info containing the names of users and their addresses. An example is given below −nameaddressAnilAndheri, Mumbai, MaharashtraJoyChandni Chowk, DelhiRonBandra, Mumbai, MaharashtraReenaOld Airport Road, Bengaluru, KarnatakaNow, if you want to just extract the information of users who stay in Mumbai, you can do that using the ... Read More
Yash Sanghvi
114 Views
Suppose you have a table exam_scores containing 5 columns. An example is given below with some dummy data.nameroll_nosubjecttotal_marksmarks_obtainedAnil1English10056Anil1Math10065Anil1Science10045Roy2English10078Roy2Math10098Roy2Science10067Now, one student could have sat for exams of multiple subjects, and therefore, there are multiple rows for 1 student. If you wish to find out the total number of students in the ... Read More
Yash Sanghvi
2K+ Views
If you are a programmer, you may be very familiar with IF-ELSE statements. The equivalent in PostgreSQL is CASE WHEN.Let’s understand with an example. If you have table marks containing percentage marks of a student, and you want to find out whether the students have passed or failed. An example ... Read More
To Continue Learning Please Login
Login with Google