Category Archives: Library

1.4 Hello Java Program

In this section, we will learn how to write the simple program of Java. We can write a simple hello Java program easily after installing the JDK. To create a simple Java program, you need to create a class that contains the main method. Let’s understand the requirement first. The requirement for Java Hello World… Read More »

1.3 C++ vs Java

There are many differences and similarities between the C++ programming language and Java. A list of top differences between C++ and Java are given below: Comparison Index C++ Java Platform-independent C++ is platform-dependent. Java is platform-independent. Mainly used for C++ is mainly used for system programming. Java is mainly used for application programming. It is widely used in… Read More »

1.2 History and Features of Java

The history of Java is very interesting. Java was originally designed for interactive television, but it was too advanced technology for the digital cable television industry at the time. The history of Java starts with the Green Team. Java team members (also known as Green Team), initiated this project to develop a language for digital… Read More »

1.1 What is Java?

Java is a general-purpose, class-based, object-oriented programming language designed for having lesser implementation dependencies. It is a computing platform for application development. Java is fast, secure, and reliable, therefore. It is widely used for developing Java applications in laptops, data centers, game consoles, scientific supercomputers, cell phones, etc. What is Java Platform? Java Platform is… Read More »

OOP With Java Syllabus

Basics of Java What is Java? History and Features of Java C++ vs Java Hello Java Program Internal How to set the path? JDK, JRE, and JVM (Java Virtual Machine) Internal details of JVM Unicode System Operators Keywords Control Statements like if-else, switch, For loop, while loop Class, Object, and Types of classes Naming convention… Read More »

1.1 Python Installation

Introduction Python is a widely used high-level programming language first launched in 1991. Since then, Python has been gaining popularity and is considered as one of the most popular and flexible server-side programming languages. Unlike most Linux distributions, Windows does not come with the Python programming language by default. However, you can install Python on your… Read More »

35.11 Join

Join Two or More Tables You can combine rows from two or more tables, based on a related column between them, by using a JOIN statement. Consider you have a “users” table and a “products” table: users { id: 1, name: ‘John’, fav: 154},{ id: 2, name: ‘Peter’, fav: 154},{ id: 3, name: ‘Amy’, fav:… Read More »

35.10 Limit

Limit the Result You can limit the number of records returned from the query, by using the “LIMIT” statement: Example Select the 5 first records in the “customers” table:import mysql.connectormydb = mysql.connector.connect(  host=”localhost”,  user=”yourusername“,  password=”yourpassword“,  database=”mydatabase”)mycursor = mydb.cursor()mycursor.execute(“SELECT * FROM customers LIMIT 5”)myresult = mycursor.fetchall()for x in myresult:  print(x) Output:C:\Users\My Name>python demo_mysql_limit.py(1, ‘John’, ‘Highway 21’)(2, ‘Peter’, ‘Lowstreet 27’)(3, ‘Amy’, ‘Apple st… Read More »

35.9 Update Table

Update Table You can update existing records in a table by using the “UPDATE” statement: Example Overwrite the address column from “Valley 345” to “Canyoun 123”:import mysql.connectormydb = mysql.connector.connect(  host=”localhost”,  user=”yourusername“,  password=”yourpassword“,  database=”mydatabase”)mycursor = mydb.cursor()sql = “UPDATE customers SET address = ‘Canyon 123’ WHERE address = ‘Valley 345′”mycursor.execute(sql)mydb.commit()print(mycursor.rowcount, “record(s) affected”) Output:C:\Users\My Name>python demo_mysql_update.py1 record(s) affected Important!: Notice the statement: mydb.commit(). It is… Read More »

35.8 Drop Table

Delete a Table You can delete an existing table by using the “DROP TABLE” statement: Example Delete the table “customers”:import mysql.connectormydb = mysql.connector.connect(  host=”localhost”,  user=”yourusername“,  password=”yourpassword“,  database=”mydatabase”)mycursor = mydb.cursor()sql = “DROP TABLE customers”mycursor.execute(sql)#If this page was executed with no error(s), you have successfully deleted the “customers” table. Output:C:\Users\My Name>python demo_mysql_drop_table.py Drop Only if Exist If the the table you… Read More »