DBMS Interview Q&A Part- 1

Q. What is Data ?

A. Data refers to raw facts and figures that can be recorded.

Q. What is Database ?

A. Database refers to the collection of interrelated and coherent data.

Q. Explain DBMS ?

A. DBMS stands for Database Management System. It is a software
package designed to define, manipulate, retrieve and manage data in
database.

Q. Why DBMS ?

A. To make information easy to access and protected, we use database
management systems. DBMS is important because it manages the data
efficiently and allow users to perform multiple tasks on it with the ease.

Q. What is a database system?

A. The collection of database and DBMS software together is known as a
database system.

Q. What do you mean by Data Modelling ?

A. Data Modelling is the set of conceptual tools for describing data
relationship, data semantics, and consistency constraints. Different data
models are : Network model, Relational model, Object Oriented model, ER
model, and more.

Q. Explain RDBMS ?

A. RDBMS stands for Relational Database Management System. It
arranges information into allied rows and columns. RDMS is an information
management system which is oriented on a data model. RDBMS Example
systems are SQL Server, Oracle, MySQL, MariaDB and SQLite.

Q. Explain Abstraction of Data, with reference to DBMS ?

A. Data Abstraction refers to the process of hiding background details from
user.

Q. Explain the 3 L’s of Data Abstraction ?

A. It refers to three levels of abstraction. They are :

  1. Physical Level : It is lowest level of abstraction. It describes how data is
    actually stored. It also describes complex data structure in detail.
  2. Logical Level : It describes what data get stored in the database and what are the relationships among them.
  3. View Level : It is the highest level of data abstraction that only describes a part of database indirectly
Q. What is Database Schema ?

A. Schema refers to the overall structure of database without data values.

Q. What do you mean by transparent DBMS?

A. The transparent DBMS is a type of DBMS which keeps its physical
structure hidden from users.

Q. Explain ER Model ?

A. This model is based on the perception of real world that consists of
collection of basic entities and relationship among these objects. It is the
graphical representation of the database.

Q. What do you understand by Data Independency ?

A. It refers to the capacity to change data at one level without affecting next
higher level is called Data Independence. It is of two types : Physical DI,
Logical DI.
Physical DI : It indicates that physical storage of device could be changed
without affecting conceptual view.
Logical DI : It indicates that conceptual schema can be changed without
affecting existing external schema.

Q. What is a Database Language ?

A. Database Language is a medium by which we can interact with the
database system through some set of commands. These commands are
structured.

Q. What is a Tuple ?

A. A single row of a table, which contains a single record for that relation is
called a tuple.

Q. Explain degree and Cardinality ?

A. Degree is the total number of attributes in a relation or table and
cardinality is total number of tuples/rows in a relation/table.

Q. What is a relation in DBMS ?

A. A database relation refers to an individual table in a relational database.
A table is a relation because it stores the relation between data in its
column-row format.

Q. What is the role of DML Compiler ?

A. It translates DML statements in a query language into low-level
instructions that the query evaluation engine can easily understand.

Q. Explain me the role of using clause for queries ?

A. Clause enables you to specify conditions that filters the results as per
the requirement. Some of the most commonly used clauses are : having,
where etc.

Q. What is a Query ?

A. Query is a statement that is used for the extraction of data from
database.
For example – select * from table1 is a query

Q. What is Subquery ?

A. Subquery is a query within query.
For example – select * from students where marks = ( select max(marks)
from students);

Q. Explain BCNF ?

A. BCNF is Boyce-Codd Normal Form. It is considered to be the advanced
version of 3 NF. Hence it is also refered to as 3.5 NF. A relation is said to
be in BCNF, if it satisfies following rules :

  1. It is in 3NF.
  2. For every functional dependency P->Q, P should be the super key of the table.
Q. What are Stored Procedures ?

A. Stored Procedure refers to the set of Structured Query Language(SQL)
statements stored in a relational database management system as a group.
It can further be reused and shared by multiple programs. It provides a
layer of security between a user interface and database.

Tagged : / /

How to set read more button using data from database in Laravel?

Hi friends, I want to add read more… button in my blade file where data is coming from database.

below is my code in blade file getalldata.blade.php

<ul class="text-justify">
	<li>
        <small>{{$users->pro_experience}}</small>
    </li>
</ul>

In above Unordered list I am getting a long data from database and I want to add a Read more and Read Less toggle option. Now follow below steps to get your result now.

getalldata.blade.php

<ul class="text-justify">
	<li class="">
		<!-- <small>{{$users->pro_experience}}</small> -->
		@if(strlen($users->pro_experience) > 50)
			{{substr($users->pro_experience,0,50)}}
			<span class="read-more-show hide_content">More<i class="fa fa-angle-down"></i></span>
			<span class="read-more-content"> {{substr($users->pro_experience,50,strlen($users->pro_experience))}} 
			<span class="read-more-hide hide_content">Less <i class="fa fa-angle-up"></i></span> </span>
		@else
			{{$users->pro_experience}}
		@endif
	</li>
</ul>

Javascript Code

<script type="text/javascript">
// Hide the extra content initially:
            $('.read-more-content').addClass('hide_content')
            $('.read-more-show, .read-more-hide').removeClass('hide_content')

            // Set up the toggle effect:
            $('.read-more-show').on('click', function(e) {
              $(this).next('.read-more-content').removeClass('hide_content');
              $(this).addClass('hide_content');
              e.preventDefault();
            });
            $('.read-more-hide').on('click', function(e) {
              var p = $(this).parent('.read-more-content');
              p.addClass('hide_content');
              p.prev('.read-more-show').removeClass('hide_content'); // Hide only the preceding "Read More"
              e.preventDefault();
            });
</script>

CSS Code

<style type="text/css">
    .read-more-show{
      cursor:pointer;
      color: #ed8323;
    }
    .read-more-hide{
      cursor:pointer;
      color: #ed8323;
    }

    .hide_content{
      display: none;
    }
</style>

Resources :

  1. Click Here
  2. Click Here
Tagged : / / / / /

How to set a selected option using ajax in Laravel 5.6?

Hey friends, I am trying to show database column data in my edit form of a Laravel project. yesterday I failed to show data from database in a select list using ajax. so let’s see the below blade file and ajax also to get your solution.

edit.blade.php
<div class="form-group">
  <label for="Blood_Group">Blood Group</label>
	<select class="form-control" id="bgroup" name="bgroup">
	  <option value="" disabled selected>Select BG</option>
	  <option value="O+">O+</option>
	  <option value="O-">O-</option>
	  <option value="A+">A+</option>
	  <option value="A-">A-</option>
	  <option value="B+">B+</option>
	  <option value="B-">B-</option>
	  <option value="AB+">AB+</option>
	  <option value="AB+">AB-</option>
	</select>
</div>
profile.js
$.ajax({
	type: "GET",
	url: 'addprofile',
	data: null,
	success: function(response) {
          let data = response.data;
          $("#bgroup").append('<option value=' + data[0].bgroup+ '>' + data[0].bgroup+ 
           '</option>');

        }
});

Error : updated data from database is not showing in selected list when i am trying to update it again.

Solution :
$("#bgroup").val(data[0].bgroup).attr('selected','selected');

You can also use below code:

$('#bgroup option[value="' + data[0].bgroup+ '"]').prop('selected', true);

Above solution is working for me. so if you have more solution on select option then please feel free to comment and share your knowledge.

Resources :

  1. Click here
  2. Click here

Tagged : / / / /

How to configure WordPress date and time settings ?

Date-Time Is showing wrong.

Hey friends, Today I am going to explain you about wordpress date and time settings. Today I saw something in blog post that time is not showing as in my pc time. so i totally confused after seeing this. so i decided to fix it. so that is for this. Let’s get started :

Step 1 : Login to your wordpress as Administrator

Step 2 : Under Dashboard, click Settings, and then click General.

Step 3 : Scroll down to the Timezone list box, and then select the time zone you want.

Time zones are grouped geographically under Africa, America, Asia, Europe, and other regions.

Step 4 : Under Date Format, select one of the predefined formats for WordPress to use to display dates.

Step 5 : Under Time Format, select one of the predefined formats.

Step 6 : at last click Save Changes.

Tagged :

How to add jQuery DataTables into your Laravel projects?

First of all, let’s discus here, What is DataTable?

Datatable is a plugin for jQuery JS Library. it’s really flexible tool. it provides the search, filter & pagination and it’s also mobile friendly.

📚 Step 1 : Open Datatables website (URL )

📚 Step 2 : Copy CSS & JS CDN Link from Home page

//cdn.datatables.net/1.10.24/css/jquery.dataTables.min.css
//cdn.datatables.net/1.10.24/js/jquery.dataTables.min.js

📚 Step 3 : Add it to your blade file. just see below how to add these css and js cdn links into your particular pages.

@section('css')
   <link rel="stylesheet"href="//cdn.datatables.net/1.10.24/css/jquery.dataTables.min.css">
@endsection

📚 Step 4 : Now Adding JS CDN

@push('scripts')
   <script src="//cdn.datatables.net/1.10.24/js/jquery.dataTables.min.js">
@endpush

📚 Step 5 : Add one more script which is the ID of your table where you are going to active your datatable. if you will see below code then you will find a ID (#myTable). it is your table id. in your case it will be something else.

<script>
		$(document).ready( function () {
			$('#myTable').DataTable();
		} );
</script>

Note : if you are using DataTable into your particular page then only add in that particular file and if you are going to use it multiple places then add it to your main file like app.blade.php .

Hey friends after following above steps you will find your view like below image :

Laravel 8 – Insert record using ajax

Hey friends, I came again to all of you with a new article, must follow below steps to create a CRUD in Laravel using ajax.

📚 Step 1 : create a Laravel project using below command.

       composer create-project laravel/laravel Studentsform

📚 Step 2 : Make a model for this, run below command: after running below command you will find a model name Student and one migration 2021_05_01_create_students_table

php artisan make:model Student -m

📚 Step 3 : Create a StudentController now using below command

php artisan make:controller StudentController

📚 Step 4 : Now open migration and add some column in it

Schema::create('students', function(Blueprint $table)) {
	$table->id();
	$table->string('firstname');
	$table->string('lastname');
	$table->string('email');
	$table->string('phone');
	$table->timestamps();
}

📚 Step 5 : Add table name in Student model and also write fillable area for it with your table column name.

    protected $table = 'students';
	protected $fillable = ['firstname','lastname','email','phone'];

📚 Step 6 : now migrate all your migration using below command , before migrating make sure to create a Database for it.

php artisan migrate

📚 Step 7 : And then Open StudentController.php (app/Http/Controllers/StudentController) and create a function name index().

📄 StudentController.php
public function index()
 {
	$students = Student::orderBy('id','DESC')->get();
	return view('students',compact('students'));
 }

📚 Step 8 : Let’s create a route for this. so now open web.php file situated under routes folder and add also controller location within web.php.

📄 web.php
Use App\Http\Controllers\StudentController
Route::get('/students',[StudentController::class,'index']);

📚 Step 9 : Now create a view file under resources/views with name students.blade.php and below code in it

📄 students.blade.php
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Ajax Crud</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6" crossorigin="anonymous">
</head>
<body>
    <section style="padding-top:60px">
        <div class="container">
            <div class="row">
                <div class="col-md-12">
                    <div class="card">
                        <div class="card-header">
                            Students <a href="#" class="btn btn-success" data-bs-toggle="modal" data-bs-target="#StudentModal">Add New Students</a>
                        </div>
                        <div class="card-body">
                            <table id="studentTable" class="table">
                                <thead>
                                    <tr>
                                        <th>First Name</th>
                                        <th>Last Name</th>
                                        <th>Email</th>
                                        <th>Phone</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    @foreach($students as $student)
                                        <tr>
                                            <td>{{$student->firstname}}</td>
                                            <td>{{$student->lastname}}</td>
                                            <td>{{$student->email}}</td>
                                            <td>{{$student->phone}}</td>
                                        </tr>
                                    @endforeach
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- modal start -->

    <!-- Button trigger modal -->
    <!-- Modal -->
    <div class="modal fade" id="StudentModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
        <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
            <h5 class="modal-title" id="exampleModalLabel">Add new student</h5>
            <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
            </div>
            <div class="modal-body">
            <form action="" id="studentForm">
                @csrf
                <div class="form-group">
                    <label for="FirstName">First Name</label>
                    <input type="text" class="form-control" id="firstname">
                </div>
                <div class="form-group">
                    <label for="LastName">Last Name</label>
                    <input type="text" class="form-control" id="lastname">
                </div>
                <div class="form-group">
                    <label for="email">Email</label>
                    <input type="text" class="form-control" id="email">
                </div>
                <div class="form-group">
                    <label for="phone">Phone</label>
                    <input type="text" class="form-control" id="phone">
                </div>
                <button type="submit" class="btn btn-primary">Submit</button>
            </form>
            </div>
            
        </div>
        </div>
    </div>
    <script>
        $("#studentForm").submit(function(e){
            e.preventDefault();
            let firstname = $("#firstname").val();
            let lastname = $("#lastname").val();
            let email = $("#email").val();
            let phone = $("#phone").val();
            let _token = $("input[name=_token]").val();

            $.ajax({
                url: "{{route('student.add')}}",
                type:"POST" ,
                data: {
                    firstname:firstname,
                    lastname:lastname,
                    email:email,
                    phone:phone,
                    _token:_token
                },
                success:function(response)
                {
                    if(response){
                        $("#studentTable tbody").prepend('<tr><td>'+response.firstname+'</td><td>'+response.lastname+' </td><td>'+response.email+'</td><td>'+response.phone+'</td></tr>');
                        $("#studentForm")[0].reset();
                        $("#studentModal").modal('hide');
                    }
                }
            });

        });
    </script>
    <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.1/dist/umd/popper.min.js" integrity="sha384-SR1sx49pcuLnqZUnnPwx6FCym0wLsk5JZuNx2bPPENzswTNFaQU1RDvt3wT4gWFG" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/js/bootstrap.min.js" integrity="sha384-j0CNLUeiqtyaRmlzUHCPZ+Gy5fQu0dQ6eZ/xAww941Ai1SxSY+0EQqNXNE6DZiVc" crossorigin="anonymous"></script>
    <script src="https://code.jquery.com/jquery-3.6.0.js" integrity="sha256-H+K7U5CnXl1h5ywQfKtSj8PCmoN9aaq30gDh27Xc0jk=" crossorigin="anonymous"></script>
</body>
</html>

📚 Step 10 : Create another function in StudentController.php

public function addStudent(Request $request)
	{
		$student = new Student();
		$student->firstname = $request->firstname;
		$student->lastname = $request->lastname;
		$student->email = $request->email;
		$student->phone = $request->phone;
		$student->save();
		return response()->json($student);
	}

📚 Step 11 : Now create a route for addStudent() function, so for this open web.php file again

Route::post('/add-student', [StudentController::class,'addStudent'])->name('student.add');

At last fill the data into popup form and you will see that your form is working fine. yay we did it. Let’s congratulate yourself that you create a CRUD using ajax in Laravel 8.

If you find any issue on above steps then feel free to comment. I will feel very happy to resolve your problems in it.

Tagged : /

150+ Developer Resources. you must see these resources in 2021.

Hey folks, these are the article, videos and awesome blogs which i am going to prefer you in 2021. these resources will help you a lot. so let’s see below what i am going to provide you with my research.

HTML Resources

#TitleMy Thoughts
1.HTML: <!DOCTYPE> tagYou will love these basics html tag.
2.W3S HTML5 Semantic ElementsGreat quick intro to why everything shouldn’t be in a <div>.
3.MDN HTML elements referencewhat a great info about all html tags. you have to look these explanations once when you are a beginner.
4.New Structural Elements in HTML5This link will help you to understand elements like <time>, <figure>, <article> etc.
5.HTML5 Periodical TableI really like the concept of this website. this website gives me the feel of like chemistry periodic table.
6.Scripts: async, deferIt will give you the best example to embed JS in html files.
7.Learn to Code HTML & CSSIt will really a fast crash course of HTML. You will love it.
8.metatags.ioOne of the best generators to create meta tags for your social media platforms like: Facebook, twitter and LinkedIn etc.
9.getwaves.ioSuch an awesome website to create awesome waves to separate sections in your website.

CSS Resources

#TitleThoughts
10.Bootstrap DocumentationYou are very known of this website if you are using bootstrap in your template. so always use this for bootstrap default class and new changes in latest versions.
11.Specifics on CSS SpecificityGreat breakdown by CSS-Tricks and has nice graphic examples at the end.
12.CSS Box SizingIt will help you to understand, how the box-model works.
13.12 tips for amazing CSS animationSuch and amazing tips on CSS animation with full of brief explanations.
14.CSS Layout and AnimationsYou must read it and it will help you lot on CSS Layout and animations.
15.Net Ninja SASS TutorialWhenever i visit his channel, He gives me a positive vibes to learn new things in a very easy and cool way.
16.Learn Sass In 20 Minutesif you are a beginner about SASS, then must watch this video first.
17.BEM and SASS: A Perfect MatchThis blew my mind when introduced how BEM and SASS could be used together.
18.getbem.comIt gives an overview from the creators of the popular naming convention.
19.BEM by ExampleThis explanation on BEM is really good, but I especially like how they have a short and full versions of the article.
20.MDN Display DocsEverything you could ever want to know about the powerful display property.
21.A Couple of Use Cases for Calc()calc() is one of the more powerful features in CSS and this article shows some great use cases for it.
22.Wes Bos CSS GridYou can’t argue with free and that Wes Bos is one of the best teachers out there for development.
23.CSSmaticCollection of powerful css generators for gradients, border radius, noise texture and box shadows.
24.CSS Tricks Positionafter reading this you will know the power of position property.
25.Can I Use?This site lets you know the browser support for every property out there.
26.yoksel Flex CheatsheetI love the layout and way it lets you visually preview the flexbox properties.
27.The 30 CSS Selectors You Must MemorizeIt such an super article on CSS selectors. I loved it.
28.CSS LintThis tool will check your code and highlight any errors.
29.System Font StackPredefined font fallback stacks that can be plugged into a project.
30.Neumorphism.ioJust follow and you will understand about Neumorphism.
31.Advanced CSS and Sass: Flexbox, Grid, Animations and More!Udemy has great videos on CSS and other courses also.
32.CSS Scroll ShadowsThis tool generates shadows that appear based on scroll position with just CSS!

JavaScript Resources

#TitleMy Thoughts
33.JavaScript in 4 HoursEvery developers should watch this videos on JavaScript intro and other things . very well explained.
34.javascript.infoThis is one of the complete and well explained overview of JS.
35.Code BeautifyIt is such an great tool to beautify your JavaScript.
36.Truthy and Falsy: When All is Not Equal in JavaScriptThis article is a great reference for all the instances that a value might be considered true or false.
37.What the heck is the event loop anyway?watch and understand about event loop in JavaScript.
38.JavaScript LoopsIf I could only read one article to understand common JS loops, this would be the one.
39.MDN JS StringEverything I’d ever want to know about strings and where to use them.
40.Google Hosted Library jQueryyou must bookmark this url to know about latest jQuery CDN script.
41.Public APIsGreat list of public APIs that you can use it very easily in your projects!

Be with us and be safe. you will get more list soon. Let’s share your best content on CSS, JS and Other web technologies.