Reset
Fetch Employees with ID Up to 50000
Program Info
Program Code
×

Fetch Employees with ID Up to 50000

Fetches all employees whose employee ID is less than or equal to 50000 and displays the result.

Footer

×

Fetch Employees with ID Up to 50000

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class Query_Controller extends Controller
{
    public function index()
    {
        $data = DB::table('employee')->where('id','<=',50000)->get();
        echo "<pre>";
        print_r($data->toArray());

    }
}

Footer

Fetch Employees Within an ID Range
Program Info
Program Code
×

Fetch Employees Within an ID Range

This query fetches all employees whose ID is between 10 and 20.

Footer

×

Fetch Employees Within an ID Range

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class Query_Controller extends Controller
{
    public function index()
    {
        $data = DB::table('employee')->whereBetween('id',[10,20])->get();
        echo "<pre>";
        print_r($data->toArray());
    }
}

Footer

Fetch the First Employee from India with Gender O
Program Info
Program Code
×

Fetch the First Employee from India with Gender O

This query retrieves the first employee record from the employee table whose address is India and gender is O. It displays the retrieved record using print_r().

Footer

×

Fetch the First Employee from India with Gender O

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class Query_Controller extends Controller
{
    public function index()
    {
        $data = DB::table('employee')->where(['address'=>'india','gender'=>'O'])->first();
        echo "<pre>";
        print_r($data);


    }
}

Footer

Find a Single Employee by ID
Program Info
Program Code
×

Find a Single Employee by ID

This query finds one employee from the employee table using ID 10 and displays the employee's data.

Footer

×

Find a Single Employee by ID

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class Query_Controller extends Controller
{
    public function index()
    {
        $data = DB::table('employee')->find(10);
        echo "<pre>";
        print_r($data);


    }
}

Footer

Find Employee by Dynamic ID
Program Info
Program Code
×

Find Employee by Dynamic ID

This query gets the employee ID from the request and finds that employee from the employee table.

Footer

×

Find Employee by Dynamic ID

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class Query_Controller extends Controller
{
    public function index(Request $request)
    {
        $id = $request->id;

        $data = DB::table('employee')->find($id);

        echo "<pre>";
        print_r($data);
    }
}

Footer

Find Employees by Address
Program Info
Program Code
×

Find Employees by Address

This query finds all employees whose address contains the word "india" and displays their records.

Footer

×

Find Employees by Address

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class Query_Controller extends Controller
{
    public function index()
    {
        $data = DB::table('employee')->where('address','like','%india%')->get();
        echo "<pre>";
        print_r($data->toArray());
    }
}

Footer

Find the Minimum Employee ID
Program Info
Program Code
×

Find the Minimum Employee ID

This query finds the smallest id value from the employee table.

Footer

×

Find the Minimum Employee ID

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class Query_Controller extends Controller
{
    public function index()
    {
        $data = DB::table('employee')->min('id');
        echo "<pre>";
        print_r($data);
    }
}

Footer

Get All Employees Except Specific IDs
Program Info
Program Code
×

Get All Employees Except Specific IDs

This query gets all employees from the employee table except the employees whose IDs are 1, 5, and 10.

Footer

×

Get All Employees Except Specific IDs

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class Query_Controller extends Controller
{
    public function index()
    {
        $data = DB::table('employee')->whereNotIn('id',[1,5,10])->get();
        echo "<pre>";
        print_r($data->toArray());
    }
}

Footer

Get All Employees in Descending ID Order
Program Info
Program Code
×

Get All Employees in Descending ID Order

This query gets all employees from the employee table and shows the newest records first based on the ID.

Footer

×

Get All Employees in Descending ID Order

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class Query_Controller extends Controller
{
    public function index()
    {
        $data = DB::table('employee')->orderBy('id','desc')->get();
        echo "<pre>";
        print_r($data->toArray());
    }
}

Footer

Get All Employees in ID Order
Program Info
Program Code
×

Get All Employees in ID Order

This query gets all records from the employee table and sorts them by ID in ascending order.

Footer

×

Get All Employees in ID Order

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class Query_Controller extends Controller
{
    public function index()
    {
        $data = DB::table('employee')->orderBy('id')->get();
        echo "<pre>";
        print_r($data->toArray());
    }
}

Footer

Showing page  4  of  8  (Total  77 records)
« Prev  1  2  3  4  5  6 ... 8  Next »
×
Name : Krishna Verma    |    Father's Name : Mr. Satish Kumar    |    Email ID : krishnaverma28081997@gmail.com    |    Religion : Hindu    |    Address : Dayampur, kanker khera, Meerut Cantt (250001), UP    |    Date of Birth : 28 August 1997    |    Marital Status : Non-Married    |    Place of Birth : Dayampur Kanker Khera Meerut Cantt.    |    Gender : Male    |    Age : 28    |    Contact : 9520335394    |    Father's Occupation : Sports man    |    Mother's Name : Smt. Kuntesh Devi    |    Mother's Occupation : Homemaker    |    Number of Brothers : 1    |    Number of Sisters : 1    |    Current Residence : Dayampur kanker khera meerut cantt    |    Family Type : Nuclear Family    |    Family Name : verma    |    Height : 5' 6"    |    Weight : 70 kg    |    Complexion : Fair    |    Body Type : Athletic    |    Hair Color : Black    |    Health Status : Good    |    Any Physical Disability : No    |    Highest Qualification : B.Tech (CSE)    |    Master Skill : PHP Laravel    |    Total Projects : 40 +    |    Total Skills : 25 +    |    Languages Known : Hindi and English    |    Website : krishnaportfolio.in    |    Siblings : 3    |    Nationality : Indian    |    Total Experience : 5 Years    |    LinkedIn : https://www.linkedin.com/in/krishna-verma-840b71356/    |    Total Programs : 10000    |    Total Projects : 40    |    Total Skills : 25    |    Total Experience : 5    |    Total DSA Problems : 200    |    Total Served Companies : 2    |    Leetcode : https://leetcode.com/u/krishnavermadeveloper/    |    Naukri : https://www.naukri.com/mnjuser/profile?id=&altresid